Skip to content

Commit 7a6627a

Browse files
Fix mining to an invalid target + ensure that a new block has the
correct hash internally in Python tests
1 parent 0653939 commit 7a6627a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/functional/feature_block.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ def run_test(self):
632632
self.move_tip(44)
633633
b47 = self.next_block(47, solve=False)
634634
target = uint256_from_compact(b47.nBits)
635-
while b47.sha256 < target:
635+
while b47.sha256 <= target:
636636
b47.nNonce += 1
637637
b47.rehash()
638638
self.send_blocks([b47], False, force_send=True, reject_reason='high-hash', reconnect=True)
@@ -1345,6 +1345,8 @@ def next_block(self, number, spend=None, additional_coinbase_value=0, script=CSc
13451345
block.hashMerkleRoot = block.calc_merkle_root()
13461346
if solve:
13471347
block.solve()
1348+
else:
1349+
block.rehash()
13481350
self.tip = block
13491351
self.block_heights[block.sha256] = height
13501352
assert number not in self.blocks

0 commit comments

Comments
 (0)