aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-08-21 14:33:41 +0200
committerMarcoFalke <falke.marco@gmail.com>2020-08-21 14:34:02 +0200
commitd254e6e7951fa81fad06bc82516770a0c186a2fd (patch)
tree7612e8e33cc4cdb669872d8cdb8f21deb39e8ed8 /test
parent0d9e14a6466cd1644cb659b7b79d40d8761034c0 (diff)
parent5067c5acc30c5cf87496c1bf8eb03712cc66b206 (diff)
Merge #19722: test: Add test for getblockheader verboseness
5067c5acc30c5cf87496c1bf8eb03712cc66b206 [test] Add test for getblockheader verboseness (Torhte Butler) Pull request description: Improve test coverage by adding a test for getblockheader with verbose argument set to false. ACKs for top commit: theStack: ACK https://github.com/bitcoin/bitcoin/pull/19722/commits/5067c5acc30c5cf87496c1bf8eb03712cc66b206 Tree-SHA512: e55593f1026a89dc7b796fa985b4cbcdb596e91d80d42dfb0660bda1692aaa35749ec29f9cd7032803f6225afb323f085df1ef6a9982de87be8e098f7253cdd5
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 7c70f30ca3..7f4241fb5f 100755
--- a/test/functional/rpc_blockchain.py
+++ b/test/functional/rpc_blockchain.py
@@ -38,6 +38,8 @@ from test_framework.blocktools import (
TIME_GENESIS_BLOCK,
)
from test_framework.messages import (
+ CBlockHeader,
+ FromHex,
msg_block,
)
from test_framework.mininode import (
@@ -280,6 +282,14 @@ class BlockchainTest(BitcoinTestFramework):
assert isinstance(int(header['versionHex'], 16), int)
assert isinstance(header['difficulty'], Decimal)
+ # Test with verbose=False, which should return the header as hex.
+ header_hex = node.getblockheader(blockhash=besthash, verbose=False)
+ assert_is_hex_string(header_hex)
+
+ header = FromHex(CBlockHeader(), header_hex)
+ header.calc_sha256()
+ assert_equal(header.hash, besthash)
+
def _test_getdifficulty(self):
difficulty = self.nodes[0].getdifficulty()
# 1 hash in 2 should be valid, so difficulty should be 1/2**31