Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/protocols/protocol_filter_out_70015.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions test/protocols/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Loading