From bc591377e8f398a187449b6834c7f01e0d97edde Mon Sep 17 00:00:00 2001 From: ThomasV Date: Wed, 1 Mar 2017 10:07:47 +0100 Subject: [PATCH] python3: fix integer division --- lib/blockchain.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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: