mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-27 06:19:09 +01:00
rest: Return error when header count is not integral
This commit is contained in:
@@ -279,6 +279,13 @@ class RESTTest (BitcoinTestFramework):
|
||||
json_obj = self.test_rest_request(f"/headers/5/{bb_hash}")
|
||||
assert_equal(len(json_obj), 5) # now we should have 5 header objects
|
||||
|
||||
# Test number parsing
|
||||
for num in ['5a', '-5', '0', '2001', '99999999999999999999999999999999999']:
|
||||
assert_equal(
|
||||
bytes(f'Header count out of range: {num}\r\n', 'ascii'),
|
||||
self.test_rest_request(f"/headers/{num}/{bb_hash}", ret_type=RetType.BYTES, status=400),
|
||||
)
|
||||
|
||||
self.log.info("Test tx inclusion in the /mempool and /block URIs")
|
||||
|
||||
# Make 3 tx and mine them on node 1
|
||||
|
||||
Reference in New Issue
Block a user