Skip to content

Commit

Permalink
test: solve weak blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjors committed Dec 24, 2024
1 parent 8d7d5a3 commit 4472c81
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/functional/test_framework/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,10 +815,12 @@ def is_valid(self):
return False
return True

def solve(self):
def solve(self, multiplier = 1):
# If a multiplier is provided, ensure work is between
# multiplier * target and multiplier / 2 * target
self.rehash()
target = uint256_from_compact(self.nBits)
while self.sha256 > target:
while self.sha256 > target * multiplier or (multiplier != 1 and self.sha256 <= target * multiplier / 4):
self.nNonce += 1
self.rehash()

Expand Down

0 comments on commit 4472c81

Please sign in to comment.