aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2022-09-01 18:47:36 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2022-09-01 18:47:45 +0000
commitf663b43df041da7777e6f45a8df04fa852f79106 (patch)
treeae5a84130ccaafc9f2dc2337fd98aedb608045a0 /test
parent30308cc380a8176a5ec0e0bd2beed8b9c482ccf7 (diff)
downloadbitcoin-f663b43df041da7777e6f45a8df04fa852f79106.tar.xz
QA: rpc_blockchain: Test output of getblock verbosity 0, False, and True
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/rpc_blockchain.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py
index b264f23fb5..90148f4c7c 100755
--- a/test/functional/rpc_blockchain.py
+++ b/test/functional/rpc_blockchain.py
@@ -38,6 +38,7 @@ from test_framework.messages import (
msg_block,
)
from test_framework.p2p import P2PInterface
+from test_framework.script import hash256
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
@@ -484,6 +485,10 @@ class BlockchainTest(BitcoinTestFramework):
self.wallet.send_self_transfer(fee_rate=fee_per_kb, from_node=node)
blockhash = self.generate(node, 1)[0]
+ def assert_hexblock_hashes(verbosity):
+ block = node.getblock(blockhash, verbosity)
+ assert_equal(blockhash, hash256(bytes.fromhex(block[:160]))[::-1].hex())
+
def assert_fee_not_in_block(verbosity):
block = node.getblock(blockhash, verbosity)
assert 'fee' not in block['tx'][1]
@@ -518,8 +523,13 @@ class BlockchainTest(BitcoinTestFramework):
for vin in tx["vin"]:
assert "prevout" not in vin
+ self.log.info("Test that getblock with verbosity 0 hashes to expected value")
+ assert_hexblock_hashes(0)
+ assert_hexblock_hashes(False)
+
self.log.info("Test that getblock with verbosity 1 doesn't include fee")
assert_fee_not_in_block(1)
+ assert_fee_not_in_block(True)
self.log.info('Test that getblock with verbosity 2 and 3 includes expected fee')
assert_fee_in_block(2)