aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-05-04 09:57:37 +0200
committerMacroFake <falke.marco@gmail.com>2022-05-04 09:57:40 +0200
commit9b42d62f426fd22602e4e9a589ab000e0f29a65b (patch)
treeb59920d13161806cce4b6d7864cbb2a6dcaad177 /test
parent880cec91fab1b487457f4285a4bbbc9a5b5aaecb (diff)
parentd1bfe5ebdb3d40dd45f97c751c49ebe2c549c1bc (diff)
downloadbitcoin-9b42d62f426fd22602e4e9a589ab000e0f29a65b.tar.xz
Merge bitcoin/bitcoin#25045: test: add coverage for invalid requests for `blockfilterheaders` (REST)
d1bfe5ebdb3d40dd45f97c751c49ebe2c549c1bc test: add coverage for invalid requests for `blockfilterheaders` (brunoerg) Pull request description: This PR adds test coverage for invalid requests (`Invalid hash` and `Unknown filtertype`) for `/blockfilterheaders` in REST functional test. ACKs for top commit: jonatack: ACK d1bfe5ebdb3d40dd45f97c751c49ebe2c549c1bc vincenzopalazzo: ACK https://github.com/bitcoin/bitcoin/pull/25045/commits/d1bfe5ebdb3d40dd45f97c751c49ebe2c549c1bc Tree-SHA512: 9ab7efe7131296577c60642f95921799cf1dbae9c2aaea6752d2ac9f35a1bcc72b9d742a146c314f82fe1848190a80c88836ab78fc28773ed12e97fa327828e7
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/interface_rest.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/functional/interface_rest.py b/test/functional/interface_rest.py
index 95dc40cb52..2c158e37e7 100755
--- a/test/functional/interface_rest.py
+++ b/test/functional/interface_rest.py
@@ -219,7 +219,7 @@ class RESTTest (BitcoinTestFramework):
self.generate(self.nodes[0], 1) # generate block to not affect upcoming tests
- self.log.info("Test the /block, /blockhashbyheight and /headers URIs")
+ self.log.info("Test the /block, /blockhashbyheight, /headers, and /blockfilterheaders URIs")
bb_hash = self.nodes[0].getbestblockhash()
# Check result if block does not exists
@@ -300,6 +300,12 @@ class RESTTest (BitcoinTestFramework):
assert_equal(first_filter_header, rpc_blockfilter['header'])
assert_equal(json_obj['filter'], rpc_blockfilter['filter'])
+ # Test blockfilterheaders with an invalid hash and filtertype
+ resp = self.test_rest_request(f"/blockfilterheaders/{INVALID_PARAM}/{bb_hash}", ret_type=RetType.OBJ, status=400)
+ assert_equal(resp.read().decode('utf-8').rstrip(), f"Unknown filtertype {INVALID_PARAM}")
+ resp = self.test_rest_request(f"/blockfilterheaders/basic/{INVALID_PARAM}", ret_type=RetType.OBJ, status=400)
+ assert_equal(resp.read().decode('utf-8').rstrip(), f"Invalid hash: {INVALID_PARAM}")
+
# Test number parsing
for num in ['5a', '-5', '0', '2001', '99999999999999999999999999999999999']:
assert_equal(