aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-12-20 08:58:05 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-12-20 09:00:34 +0100
commit70d6a09f5ccdc18f251bc07e5884bc85004057a1 (patch)
treec6de336e1a41e01a3fa21fc2060c8e5eddfb655b /test
parent8eeb4e997b06b0384b4386a2cfafa665bda58cb5 (diff)
parent2b64fa3251ac5ff4b4d174f1f0be7226490dce87 (diff)
Merge bitcoin/bitcoin#17631: Expose block filters over REST
2b64fa3251ac5ff4b4d174f1f0be7226490dce87 Update REST docs with new accessors (Matt Corallo) ef7c8228fd5cf45526518ae2bd5ebdd483e65525 Expose block filters over REST. (Matt Corallo) Pull request description: 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. You can test it at http://bitcoin-rest.bitcoin.ninja/rest//blockfilter/basic/header/000000005b7a58a939b2636f61fa4ddd62258c5fed57667a35d23f2334c4f86d.hex ACKs for top commit: dergoegge: ACK 2b64fa3251ac5ff4b4d174f1f0be7226490dce87 - Adding blockfilters to the REST interface is analogous to serving other public data such as transactions or blocks. Tree-SHA512: d487bc694266375c94d6fcf2e9d788a8a42a3b94e8d3290e46335a64cbcde55084ce5ea6119b79a4065888d94d7c3ae25a59a901fa46e3711f0eb296add12696
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/interface_rest.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/functional/interface_rest.py b/test/functional/interface_rest.py
index a2f84573da..9cb452e9c0 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):
@@ -272,11 +272,14 @@ class RESTTest (BitcoinTestFramework):
self.generate(self.nodes[1], 5)
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),
)