From a517347514dca14412e61b9b6ae735f6bea56107 Mon Sep 17 00:00:00 2001 From: Eric Voskuil Date: Tue, 20 Oct 2026 10:47:37 -0400 Subject: [PATCH 1/2] Include the start block in client filter responses. --- src/protocols/protocol_filter_out_70015.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/protocols/protocol_filter_out_70015.cpp b/src/protocols/protocol_filter_out_70015.cpp index 46a16d9f..cb08fcfb 100644 --- a/src/protocols/protocol_filter_out_70015.cpp +++ b/src/protocols/protocol_filter_out_70015.cpp @@ -141,8 +141,8 @@ bool protocol_filter_out_70015::handle_receive_get_filter_headers( } // bip157: difference [stop_height - start_height] MUST be less than 2000. - const auto count = subtract(stop_height, start_height); - if (count >= max_client_filter_headers) + const auto count = add1(subtract(stop_height, start_height)); + if (count > max_client_filter_headers) { stop(network::error::protocol_violation); return false; @@ -205,8 +205,8 @@ bool protocol_filter_out_70015::handle_receive_get_filters(const code& ec, } // bip157: difference [stop_height - start_height] MUST be less than 1000. - const auto count = subtract(stop_height, start_height); - if (count >= max_client_filters) + const auto count = add1(subtract(stop_height, start_height)); + if (count > max_client_filters) { stop(network::error::protocol_violation); return false; From 340ab490546d2f853701c71aeacbb5f2bbed3aa3 Mon Sep 17 00:00:00 2001 From: Eric Voskuil Date: Tue, 20 Oct 2026 17:37:01 -0400 Subject: [PATCH 2/2] Expect the start filter before an unfiltered stop. --- test/protocols/protocol.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/protocols/protocol.cpp b/test/protocols/protocol.cpp index 15f54ee7..1fcb6a8b 100644 --- a/test/protocols/protocol.cpp +++ b/test/protocols/protocol.cpp @@ -640,6 +640,9 @@ BOOST_AUTO_TEST_CASE(protocol_filter_out_70015__get_client_filters__unfiltered_s send(get_client_filters{ client_filter::type_id::neutrino, 0, descendant(1).hash() }, node_version->value); + const auto message = client_filter::deserialize(node_version->value, receive(client_filter::command)); + BOOST_REQUIRE(message); + BOOST_REQUIRE(message->block_hash == config_.bitcoin.genesis_block.hash()); BOOST_REQUIRE_THROW(receive(client_filter::command), boost::system::system_error); }