aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtest/functional/p2p_blockfilters.py56
1 files changed, 37 insertions, 19 deletions
diff --git a/test/functional/p2p_blockfilters.py b/test/functional/p2p_blockfilters.py
index e4908735c9..680fa9c7fa 100755
--- a/test/functional/p2p_blockfilters.py
+++ b/test/functional/p2p_blockfilters.py
@@ -211,38 +211,56 @@ class CompactFiltersTest(BitcoinTestFramework):
]
for request in requests:
peer_1 = self.nodes[1].add_p2p_connection(P2PInterface())
- peer_1.send_message(request)
- peer_1.wait_for_disconnect()
+ with self.nodes[1].assert_debug_log(expected_msgs=["requested unsupported block filter type"]):
+ peer_1.send_message(request)
+ peer_1.wait_for_disconnect()
self.log.info("Check that invalid requests result in disconnection.")
requests = [
# Requesting too many filters results in disconnection.
- msg_getcfilters(
- filter_type=FILTER_TYPE_BASIC,
- start_height=0,
- stop_hash=int(main_block_hash, 16),
+ (
+ msg_getcfilters(
+ filter_type=FILTER_TYPE_BASIC,
+ start_height=0,
+ stop_hash=int(main_block_hash, 16),
+ ), "requested too many cfilters/cfheaders"
),
# Requesting too many filter headers results in disconnection.
- msg_getcfheaders(
- filter_type=FILTER_TYPE_BASIC,
- start_height=0,
- stop_hash=int(tip_hash, 16),
+ (
+ msg_getcfheaders(
+ filter_type=FILTER_TYPE_BASIC,
+ start_height=0,
+ stop_hash=int(tip_hash, 16),
+ ), "requested too many cfilters/cfheaders"
),
# Requesting unknown filter type results in disconnection.
- msg_getcfcheckpt(
- filter_type=255,
- stop_hash=int(main_block_hash, 16),
+ (
+ msg_getcfcheckpt(
+ filter_type=255,
+ stop_hash=int(main_block_hash, 16),
+ ), "requested unsupported block filter type"
),
# Requesting unknown hash results in disconnection.
- msg_getcfcheckpt(
- filter_type=FILTER_TYPE_BASIC,
- stop_hash=123456789,
+ (
+ msg_getcfcheckpt(
+ filter_type=FILTER_TYPE_BASIC,
+ stop_hash=123456789,
+ ), "requested invalid block hash"
+ ),
+ (
+ # Request with (start block height > stop block height) results in disconnection.
+ msg_getcfheaders(
+ filter_type=FILTER_TYPE_BASIC,
+ start_height=1000,
+ stop_hash=int(self.nodes[0].getblockhash(999), 16),
+ ), "sent invalid getcfilters/getcfheaders with start height 1000 and stop height 999"
),
]
- for request in requests:
+ for request, expected_log_msg in requests:
peer_0 = self.nodes[0].add_p2p_connection(P2PInterface())
- peer_0.send_message(request)
- peer_0.wait_for_disconnect()
+ with self.nodes[0].assert_debug_log(expected_msgs=[expected_log_msg]):
+ peer_0.send_message(request)
+ peer_0.wait_for_disconnect()
self.log.info("Test -peerblockfilters without -blockfilterindex raises an error")
self.stop_node(0)