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) 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)