mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-29 21:42:32 +02:00
QA: rpc_blockchain: Test output of getblock verbosity 0, False, and True
This commit is contained in:
parent
30308cc380
commit
f663b43df0
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user