Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBD: do not check PoW (Yespower) during Download headers #122

Merged
merged 3 commits into from
May 9, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -3334,7 +3341,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()))
decryp2kanon marked this conversation as resolved.
Show resolved Hide resolved
return error("%s: Consensus::CheckBlockHeader: %s, %s", __func__, hash.ToString(), FormatStateMessage(state));

// Get prev block index
Expand Down