OSDN Git Service

fix calDiff bug due to we set the genesis block height to 1 instead of 0
authorpaladz <453256728@qq.com>
Thu, 2 Nov 2017 04:36:10 +0000 (12:36 +0800)
committerpaladz <453256728@qq.com>
Thu, 2 Nov 2017 04:36:10 +0000 (12:36 +0800)
consensus/difficulty.go

index 86e21fd..d2bd72b 100644 (file)
@@ -88,7 +88,7 @@ func CheckProofOfWork(hash *bc.Hash, bits uint64) bool {
 func CalcNextRequiredDifficulty(lastBH, compareBH *legacy.BlockHeader) uint64 {
        if lastBH == nil {
                return powMinBits
-       } else if (lastBH.Height+1)%BlocksPerRetarget != 0 {
+       } else if (lastBH.Height)%BlocksPerRetarget != 0 {
                return lastBH.Bits
        }