Skip to content

Commit 6f09738

Browse files
committed
merge bitcoin#25045: add coverage for invalid requests for blockfilterheaders (REST)
1 parent 68e4f98 commit 6f09738

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/functional/interface_rest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def run_test(self):
219219

220220
self.generate(self.nodes[0], 1) # generate block to not affect upcoming tests
221221

222-
self.log.info("Test the /block, /blockhashbyheight and /headers URIs")
222+
self.log.info("Test the /block, /blockhashbyheight, /headers, and /blockfilterheaders URIs")
223223
bb_hash = self.nodes[0].getbestblockhash()
224224

225225
# Check result if block does not exists
@@ -305,6 +305,12 @@ def run_test(self):
305305
assert_equal(first_filter_header, rpc_blockfilter['header'])
306306
assert_equal(json_obj['filter'], rpc_blockfilter['filter'])
307307

308+
# Test blockfilterheaders with an invalid hash and filtertype
309+
resp = self.test_rest_request(f"/blockfilterheaders/{INVALID_PARAM}/{bb_hash}", ret_type=RetType.OBJ, status=400)
310+
assert_equal(resp.read().decode('utf-8').rstrip(), f"Unknown filtertype {INVALID_PARAM}")
311+
resp = self.test_rest_request(f"/blockfilterheaders/basic/{INVALID_PARAM}", ret_type=RetType.OBJ, status=400)
312+
assert_equal(resp.read().decode('utf-8').rstrip(), f"Invalid hash: {INVALID_PARAM}")
313+
308314
# Test number parsing
309315
for num in ['5a', '-5', '0', '2001', '99999999999999999999999999999999999']:
310316
assert_equal(

0 commit comments

Comments
 (0)