@@ -45,7 +45,11 @@ chaser_validate::chaser_validate(full_node& node) NOEXCEPT
4545 maximum_backlog_(node.node_settings().maximum_concurrency_()),
4646 node_witness_(node.network_settings().witness_node()),
4747 defer_(node.node_settings().defer_validation),
48- filter_(!defer_ && node.archive().filter_enabled())
48+ filter_(!defer_ && node.archive().filter_enabled()),
49+ silent_(!defer_ && node.network_settings().witness_node() &&
50+ node.node_settings().headers_first &&
51+ node.system_settings().forks.bip341 &&
52+ node.archive().silent_enabled())
4953{
5054}
5155
@@ -160,13 +164,14 @@ void chaser_validate::do_bumped(height_t height) NOEXCEPT
160164
161165 const auto bypass = defer_ || is_under_checkpoint (height) ||
162166 query.is_milestone (link);
167+ const auto silent = silent_ && height >= query.silent_start_height ();
163168
164169 switch (ec.value ())
165170 {
166171 case database::error::unvalidated:
167172 case database::error::unknown_state:
168173 {
169- if (!bypass || filter_)
174+ if (!bypass || filter_ || silent )
170175 post_block (link, bypass);
171176 else
172177 complete_block (error::success, link, height, true );
@@ -175,7 +180,11 @@ void chaser_validate::do_bumped(height_t height) NOEXCEPT
175180 case database::error::block_valid:
176181 case database::error::block_confirmable:
177182 {
178- complete_block (error::success, link, height, true );
183+ if (silent && !query.is_silent_indexed (link))
184+ post_block (link, true );
185+ else
186+ complete_block (error::success, link, height, true );
187+
179188 break ;
180189 }
181190 case database::error::block_unconfirmable:
@@ -254,7 +263,7 @@ code chaser_validate::populate(bool bypass, const chain::block& block,
254263
255264 if (bypass)
256265 {
257- // Populating for filters only (no validation metadata required).
266+ // Populating optional indexes only (no validation metadata required).
258267 block.populate (ctx);
259268 if (!query.populate_without_metadata (block))
260269 return system::error::missing_previous_output;
@@ -306,7 +315,10 @@ code chaser_validate::validate(bool bypass, const chain::block& block,
306315 if (!query.set_filter_body (link, block))
307316 return error::validate7;
308317
309- // Valid must be set after set_prevouts and set_filter_body.
318+ if (silent_ && !query.set_silent (link, block))
319+ return error::validate9;
320+
321+ // Valid must be set after optional block indexes.
310322 if (!bypass && !query.set_block_valid (link))
311323 return error::validate8;
312324
@@ -334,7 +346,6 @@ void chaser_validate::complete_block(const code& ec, const header_link& link,
334346 return ;
335347 }
336348
337- // VALID BLOCK
338349 // Under deferral there is no state change, but downloads will stall unless
339350 // the window is closed out, so notify the check chaser of the increment.
340351 notify (ec, chase::valid, possible_wide_cast<height_t >(height));
0 commit comments