@@ -44,8 +44,8 @@ chaser_validate::chaser_validate(full_node& node) NOEXCEPT
4444 initial_subsidy_(node.config().bitcoin.initial_subsidy()),
4545 maximum_backlog_(node.config().node.maximum_concurrency_()),
4646 node_witness_(node.config().network.witness_node()),
47- filter_ (node.archive ().filter_enabled() ),
48- defer_( node.config ().node.defer_validation )
47+ defer_ (node.config ().node.defer_validation ),
48+ filter_(!defer_ && node.archive ().filter_enabled() )
4949{
5050}
5151
@@ -174,34 +174,18 @@ void chaser_validate::do_bumped(height_t height) NOEXCEPT
174174 const auto bypass = defer_ || is_under_checkpoint (height) ||
175175 query.is_milestone (link);
176176
177- if (bypass)
178- {
179- // Filters will be set on subsequent unsupressed run.
180- if (filter_ && !defer_)
181- {
182- post_block (link, bypass);
183- }
184- else
185- {
186- complete_block (error::success, link, height, true );
187- }
188- }
189- else switch (ec.value ())
177+ switch (ec.value ())
190178 {
191179 case database::error::unvalidated:
192180 case database::error::unknown_state:
193181 {
194- post_block (link, bypass);
195- break ;
196- }
197- case database::error::block_valid:
198- {
199- if (query.is_prevouts_cached (link))
200- post_block (link, true );
182+ if (!bypass || filter_)
183+ post_block (link, bypass);
201184 else
202185 complete_block (error::success, link, height, true );
203186 break ;
204187 }
188+ case database::error::block_valid:
205189 case database::error::block_confirmable:
206190 {
207191 complete_block (error::success, link, height, true );
@@ -283,6 +267,7 @@ code chaser_validate::populate(bool bypass, const chain::block& block,
283267
284268 if (bypass)
285269 {
270+ // Populating for filters only (no validation metadata required).
286271 block.populate ();
287272 if (!query.populate_without_metadata (block))
288273 return system::error::missing_previous_output;
@@ -316,14 +301,15 @@ code chaser_validate::validate(bool bypass, const chain::block& block,
316301 if ((ec = block.connect (ctx)))
317302 return ec;
318303
304+ // Prevouts optimize confirmation.
319305 if (!query.set_prevouts (link, block))
320306 return error::validate6;
321307 }
322308
323309 if (!query.set_filter_body (link, block))
324310 return error::validate7;
325311
326- // After set_prevouts and set_filter_body.
312+ // Valid must be set after set_prevouts and set_filter_body.
327313 if (!bypass && !query.set_block_valid (link, block.fees ()))
328314 return error::validate8;
329315
0 commit comments