File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 38
38
TIME_GENESIS_BLOCK ,
39
39
)
40
40
from test_framework .messages import (
41
+ CBlockHeader ,
42
+ FromHex ,
41
43
msg_block ,
42
44
)
43
45
from test_framework .mininode import (
@@ -280,6 +282,14 @@ def _test_getblockheader(self):
280
282
assert isinstance (int (header ['versionHex' ], 16 ), int )
281
283
assert isinstance (header ['difficulty' ], Decimal )
282
284
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
+
283
293
def _test_getdifficulty (self ):
284
294
difficulty = self .nodes [0 ].getdifficulty ()
285
295
# 1 hash in 2 should be valid, so difficulty should be 1/2**31
You can’t perform that action at this time.
0 commit comments