Skip to content

Commit d1bfe5e

Browse files
committed
test: add coverage for invalid requests for blockfilterheaders
1 parent 269dcad commit d1bfe5e

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
@@ -300,6 +300,12 @@ def run_test(self):
300300
assert_equal(first_filter_header, rpc_blockfilter['header'])
301301
assert_equal(json_obj['filter'], rpc_blockfilter['filter'])
302302

303+
# Test blockfilterheaders with an invalid hash and filtertype
304+
resp = self.test_rest_request(f"/blockfilterheaders/{INVALID_PARAM}/{bb_hash}", ret_type=RetType.OBJ, status=400)
305+
assert_equal(resp.read().decode('utf-8').rstrip(), f"Unknown filtertype {INVALID_PARAM}")
306+
resp = self.test_rest_request(f"/blockfilterheaders/basic/{INVALID_PARAM}", ret_type=RetType.OBJ, status=400)
307+
assert_equal(resp.read().decode('utf-8').rstrip(), f"Invalid hash: {INVALID_PARAM}")
308+
303309
# Test number parsing
304310
for num in ['5a', '-5', '0', '2001', '99999999999999999999999999999999999']:
305311
assert_equal(

0 commit comments

Comments
 (0)