diff --git a/lib/blockchain.py b/lib/blockchain.py index b81c3866c..bb5227427 100644 --- a/lib/blockchain.py +++ b/lib/blockchain.py @@ -283,9 +283,9 @@ class Blockchain(util.PrintError): # new target nActualTimespan = last.get('timestamp') - first.get('timestamp') nTargetTimespan = 14 * 24 * 60 * 60 - nActualTimespan = max(nActualTimespan, nTargetTimespan / 4) + nActualTimespan = max(nActualTimespan, nTargetTimespan // 4) nActualTimespan = min(nActualTimespan, nTargetTimespan * 4) - new_target = min(MAX_TARGET, (target * nActualTimespan) / nTargetTimespan) + new_target = min(MAX_TARGET, (target * nActualTimespan) // nTargetTimespan) # convert new target to bits c = ("%064x" % new_target)[2:] while c[:2] == '00' and len(c) > 6: