diff options
author | fanquake <fanquake@gmail.com> | 2022-01-02 08:16:31 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2022-01-02 08:37:12 +0800 |
commit | 9d099b02d8f02042f46401bcdbe5a729ef607308 (patch) | |
tree | 013c230cee2a17f6cb42854e9a3c942ccdf07944 /test | |
parent | 653577251011d077adea198c1c1437a56e2ae2ee (diff) | |
parent | 4523d28b6bd550bf9f9c724f9aa90c3d2d4ebe3b (diff) |
Merge bitcoin/bitcoin#23836: rest: Expose block filters follow-ups
4523d28b6bd550bf9f9c724f9aa90c3d2d4ebe3b [test] compare filter and header with the result of the getblockfilter RPC (Niklas Gögge)
3a2464f21619c3065ec2f5d8f7431703c30c964a [rest] drop superfluous rpc serializations flags for block filters (Niklas Gögge)
064abd14a55e0fa1bff530237816a748d01e0ddb [rest] add a more verbose error message for invalid header counts (Niklas Gögge)
83b8f3a8961baa34a136ecfaf62c3ea0d133b6d6 [refactor] various style fix-ups (Niklas Gögge)
Pull request description:
This PR addresses unresolved review comments from [#17631](https://github.com/bitcoin/bitcoin/pull/17631).
This includes:
* various style fix-ups
* returning a more verbose error message for invalid header counts
* removing superfluous rpc serializations flags for block filters
* improving the test to include comparing the block filters returned from the rest with the ones returned from the `getblockfilter` RPC.
ACKs for top commit:
jnewbery:
ACK 4523d28b6bd550bf9f9c724f9aa90c3d2d4ebe3b
brunoerg:
tACK 4523d28b6bd550bf9f9c724f9aa90c3d2d4ebe3b
Tree-SHA512: 634e6b2ae3e1d5f31675a50cfe11a5e74bf5a51b9e7b512d9e18879bf2ed424fc0ac6ec633023f192e3ad12cf0c73b0b51de79dd7ec00844dba3e1493d823b8c
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/interface_rest.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/test/functional/interface_rest.py b/test/functional/interface_rest.py index 9cb452e9c0..2842b2534d 100755 --- a/test/functional/interface_rest.py +++ b/test/functional/interface_rest.py @@ -273,13 +273,19 @@ 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 json_obj = self.test_rest_request(f"/blockfilterheaders/basic/5/{bb_hash}") + first_filter_header = json_obj[0] assert_equal(len(json_obj), 5) # now we should have 5 filter header objects - self.test_rest_request(f"/blockfilter/basic/{bb_hash}", req_type=ReqType.BIN, ret_type=RetType.OBJ) + json_obj = self.test_rest_request(f"/blockfilter/basic/{bb_hash}") + + # Compare with normal RPC blockfilter response + rpc_blockfilter = self.nodes[0].getblockfilter(bb_hash) + assert_equal(first_filter_header, rpc_blockfilter['header']) + assert_equal(json_obj['filter'], rpc_blockfilter['filter']) # Test number parsing for num in ['5a', '-5', '0', '2001', '99999999999999999999999999999999999']: assert_equal( - bytes(f'Header count out of acceptable range (1-2000): {num}\r\n', 'ascii'), + bytes(f'Header count is invalid or out of acceptable range (1-2000): {num}\r\n', 'ascii'), self.test_rest_request(f"/headers/{num}/{bb_hash}", ret_type=RetType.BYTES, status=400), ) |