Browse Source

python3: fix integer division

seed_v14
ThomasV 8 years ago
parent
commit
bc591377e8
  1. 4
      lib/blockchain.py

4
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:

Loading…
Cancel
Save