diff --git a/src/validation.cpp b/src/validation.cpp index 52fa782f3..d8e83003a 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3047,6 +3047,13 @@ static bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, if (fCheckPOW && !CheckProofOfWork(block.GetPoWHash_cached(), block.nBits, consensusParams)) return state.DoS(50, false, REJECT_INVALID, "high-hash", false, "proof of work failed"); + // FIXME.SUGAR // check PoW: SKIPPED during downloading headers (IBD) + // You can see this log when IBD. + // This means PoW check during IBD is not actually skipped, but still its checking in another places. + // What we skipped is only when Downloading headers, but not else. This makes IBD much faster. + // if (IsInitialBlockDownload()) + // printf("%s IBD=%d CBH=%s\n", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()).c_str(), IsInitialBlockDownload(), block.GetHash().ToString().c_str()); + return true; } @@ -3057,8 +3064,9 @@ bool CheckBlock(const CBlock& block, CValidationState& state, const Consensus::P if (block.fChecked) return true; + // FIXME.SUGAR // check PoW: SKIPPED during downloading headers (IBD) // Check that the header is valid (particularly PoW). This is mostly - // redundant with the call in AcceptBlockHeader. + // redundant with the call in AcceptBlockHeader, but when IBD mode, its SKIPPED. if (!CheckBlockHeader(block, state, consensusParams, fCheckPOW)) return false; @@ -3334,7 +3342,9 @@ bool CChainState::AcceptBlockHeader(const CBlockHeader& block, CValidationState& return true; } - if (!CheckBlockHeader(block, state, chainparams.GetConsensus())) + // FIXME.SUGAR // check PoW: SKIPPED during downloading headers (IBD) + // IBD: do not check PoW (Yespower) during Download headers for performance reason + if (!IsInitialBlockDownload() && !CheckBlockHeader(block, state, chainparams.GetConsensus())) return error("%s: Consensus::CheckBlockHeader: %s, %s", __func__, hash.ToString(), FormatStateMessage(state)); // Get prev block index