From b21270c4b8739aca571f66648f1a5f7826ac21f7 Mon Sep 17 00:00:00 2001 From: Eric Voskuil Date: Wed, 26 Aug 2026 17:52:38 -0400 Subject: [PATCH 1/2] Clamp download window to bypass height until fully associated. --- include/bitcoin/node/chasers/chaser_check.hpp | 1 + src/chasers/chaser_check.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/bitcoin/node/chasers/chaser_check.hpp b/include/bitcoin/node/chasers/chaser_check.hpp index 6d0718b7..3bf5dbd8 100644 --- a/include/bitcoin/node/chasers/chaser_check.hpp +++ b/include/bitcoin/node/chasers/chaser_check.hpp @@ -97,6 +97,7 @@ class BCN_API chaser_check const float allowed_deviation_; const size_t maximum_concurrency_; const size_t maximum_height_; + const size_t bypass_height_; const size_t connections_; const size_t step_; diff --git a/src/chasers/chaser_check.cpp b/src/chasers/chaser_check.cpp index 5561d276..ba52328e 100644 --- a/src/chasers/chaser_check.cpp +++ b/src/chasers/chaser_check.cpp @@ -64,6 +64,8 @@ chaser_check::chaser_check(full_node& node) NOEXCEPT allowed_deviation_(node.node_settings().allowed_deviation), maximum_concurrency_(node.node_settings().maximum_concurrency_()), maximum_height_(node.node_settings().maximum_height_()), + bypass_height_(std::max(node.system_settings().milestone.height(), + node.system_settings().top_checkpoint().height())), connections_(get_target_connections(node.network_settings())), step_(get_step(connections_, maximum_concurrency_)) { @@ -509,10 +511,14 @@ size_t chaser_check::set_unassociated() NOEXCEPT // The last request (requested_) stops at the last gap in the window, but // validation continues until the next gap. Start next scan above validated // not last requested, since all between are already downloaded. + // Bypassed blocks may archive unprobed, so the window must not extend + // above the bypass height until all blocks at/below it are associated. const auto& query = archive(); const auto previous = requested_; const auto step = ceilinged_add(position(), maximum_concurrency_); - const auto stop = std::min(step, maximum_height_); + const auto span = std::min(step, maximum_height_); + const auto stop = position() < bypass_height_ ? + std::min(span, bypass_height_) : span; size_t count{}; while (true) From 72f7fb0c50a3053a9e4ea0aefa0d4cb2b9748fe4 Mon Sep 17 00:00:00 2001 From: Eric Voskuil Date: Mon, 31 Aug 2026 16:56:42 -0400 Subject: [PATCH 2/2] Test style. --- test/functional/p2p.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/functional/p2p.cpp b/test/functional/p2p.cpp index 0d244a86..61fffefa 100644 --- a/test/functional/p2p.cpp +++ b/test/functional/p2p.cpp @@ -26,8 +26,7 @@ BOOST_AUTO_TEST_CASE(functional_p2p__handshake__default__provides_network_and_wi { BOOST_REQUIRE(handshake()); BOOST_REQUIRE_EQUAL(node_version->value, config_.network.protocol_maximum); - BOOST_REQUIRE_EQUAL(node_version->services, - service::node_network | service::node_witness); + BOOST_REQUIRE_EQUAL(node_version->services, service::node_network | service::node_witness); } BOOST_AUTO_TEST_CASE(functional_p2p__ping__nonce__pong_echo)