diff options
author | Matt Corallo <git@bluematt.me> | 2019-11-28 22:39:12 -0500 |
---|---|---|
committer | Matt Corallo <git@bluematt.me> | 2021-10-17 02:56:56 +0000 |
commit | ef7c8228fd5cf45526518ae2bd5ebdd483e65525 (patch) | |
tree | 7bb6ce58e8a924f4d68898bb95ec72c8e008bc7e /test/functional | |
parent | 810ce36d54e4a047f27a099e8295ddadfced75a9 (diff) |
Expose block filters over REST.
This adds a new rest endpoint:
/rest/blockfilter/filtertype/requesttype/blockhash (eg
/rest/blockfilter/basic/header/000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f.hex)
which exposes either the filter "header" or the filter data itself.
Most of the code is cribbed from the equivalent RPC.
Diffstat (limited to 'test/functional')
-rwxr-xr-x | test/functional/interface_rest.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/functional/interface_rest.py b/test/functional/interface_rest.py index adc33bd9df..3490d8808c 100755 --- a/test/functional/interface_rest.py +++ b/test/functional/interface_rest.py @@ -41,7 +41,7 @@ class RESTTest (BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 2 - self.extra_args = [["-rest"], []] + self.extra_args = [["-rest", "-blockfilterindex=1"], []] self.supports_cli = False def skip_test_if_missing_module(self): @@ -278,11 +278,14 @@ class RESTTest (BitcoinTestFramework): self.sync_all() 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}") + 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) # Test number parsing for num in ['5a', '-5', '0', '2001', '99999999999999999999999999999999999']: assert_equal( - bytes(f'Header count out of range: {num}\r\n', 'ascii'), + bytes(f'Header count 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), ) |