Skip to content

Commit d254e6e

Browse files
author
MarcoFalke
committed
Merge #19722: test: Add test for getblockheader verboseness
5067c5a [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 bitcoin/bitcoin@5067c5a Tree-SHA512: e55593f1026a89dc7b796fa985b4cbcdb596e91d80d42dfb0660bda1692aaa35749ec29f9cd7032803f6225afb323f085df1ef6a9982de87be8e098f7253cdd5
2 parents 0d9e14a + 5067c5a commit d254e6e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/functional/rpc_blockchain.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
TIME_GENESIS_BLOCK,
3939
)
4040
from test_framework.messages import (
41+
CBlockHeader,
42+
FromHex,
4143
msg_block,
4244
)
4345
from test_framework.mininode import (
@@ -280,6 +282,14 @@ def _test_getblockheader(self):
280282
assert isinstance(int(header['versionHex'], 16), int)
281283
assert isinstance(header['difficulty'], Decimal)
282284

285+
# Test with verbose=False, which should return the header as hex.
286+
header_hex = node.getblockheader(blockhash=besthash, verbose=False)
287+
assert_is_hex_string(header_hex)
288+
289+
header = FromHex(CBlockHeader(), header_hex)
290+
header.calc_sha256()
291+
assert_equal(header.hash, besthash)
292+
283293
def _test_getdifficulty(self):
284294
difficulty = self.nodes[0].getdifficulty()
285295
# 1 hash in 2 should be valid, so difficulty should be 1/2**31

0 commit comments

Comments
 (0)