Skip to content

Commit 4a58b6a

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#24797: test: compare /chaininfo response with getblockchaininfo RPC
0f7dc89 test: compare `/chaininfo` response with `getblockchaininfo` RPC (brunoerg) Pull request description: The `/chaininfo` REST endpoint gets its infos from `getblockchaininfo` RPC, so this PR adds an `assert_equal` (in `interface_rest`) to ensure both responses are the same. Obs: other endpoints do the same for their respective RPC. ACKs for top commit: 0xB10C: Concept and Code Review ACK 0f7dc89. Belts-and-spenders. Tree-SHA512: 51cbcf988090272e406a47dc869710740b74e2222af29c05ddcbf53bd49765cdc59efb525e970867f091b3d2efec4fb13371a342d9e484e51144b760265bc5b8
2 parents 747cdf1 + 0f7dc89 commit 4a58b6a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/functional/interface_rest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,10 @@ def run_test(self):
361361
json_obj = self.test_rest_request("/chaininfo")
362362
assert_equal(json_obj['bestblockhash'], bb_hash)
363363

364+
# Compare with normal RPC getblockchaininfo response
365+
blockchain_info = self.nodes[0].getblockchaininfo()
366+
assert_equal(blockchain_info, json_obj)
367+
364368
# Test compatibility of deprecated and newer endpoints
365369
self.log.info("Test compatibility of deprecated and newer endpoints")
366370
assert_equal(self.test_rest_request(f"/headers/{bb_hash}", query_params={"count": 1}), self.test_rest_request(f"/headers/1/{bb_hash}"))

0 commit comments

Comments
 (0)