diff --git a/src/chain.cpp b/src/chain.cpp index 10ab58c69d..50e3c2ca3d 100644 --- a/src/chain.cpp +++ b/src/chain.cpp @@ -145,15 +145,18 @@ int64_t CBlockIndex::GetBlockWork() const if (pprev && pprev->pprev) nTimeSpan = pprev->GetBlockTime() - pprev->pprev->GetBlockTime(); int64_t nBlockWork = 1000 - nTimeSpan; - if (nBlockWork <= 0) - nBlockWork = 1; //PoS blocks have the final decision on consensus, if it is between a PoW block and PoS block // PoS blocks are also the only type of block that has the scoring of the block directly based on the elapsed time // of this block and the prev. PoW is not bound by timestamps the same way PoS is, so it is not as safe to do with PoW if (IsProofOfStake()) { - nBlockWork += 1000 + (GetBlockTime() - pprev->GetBlockTime()); + nTimeSpan = GetBlockTime() - pprev->GetBlockTime(); + if (nTimeSpan < 0) + nTimeSpan = 1; + nBlockWork += (1000 - nTimeSpan); } + if (nBlockWork <= 0) + nBlockWork = 1; return nBlockWork; }