Skip to content

Commit f748944

Browse files
committed
Only set fNewBlock to true in AcceptBlock when we write to disk
The only affect this should have is fixing the return code in submitblock in cases where a block fails ContextualCheckBlock and not setting nLastBlockTime on peers that provide blocks which fail ContextualCheckBlock (which is only used in eviction and cosmetic).
1 parent fa6e497 commit f748944

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3513,7 +3513,6 @@ bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CVali
35133513
// request; don't process these.
35143514
if (pindex->nChainWork < nMinimumChainWork) return true;
35153515
}
3516-
if (fNewBlock) *fNewBlock = true;
35173516

35183517
if (!CheckBlock(block, state, chainparams.GetConsensus()) ||
35193518
!ContextualCheckBlock(block, state, chainparams.GetConsensus(), pindex->pprev)) {
@@ -3530,6 +3529,7 @@ bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CVali
35303529
GetMainSignals().NewPoWValidBlock(pindex, pblock);
35313530

35323531
// Write block to history file
3532+
if (fNewBlock) *fNewBlock = true;
35333533
try {
35343534
CDiskBlockPos blockPos = SaveBlockToDisk(block, pindex->nHeight, chainparams, dbp);
35353535
if (blockPos.IsNull()) {

0 commit comments

Comments
 (0)