mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
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).
This commit is contained in:
parent
fa6e49731b
commit
f74894480d
1 changed files with 1 additions and 1 deletions
|
@ -3513,7 +3513,6 @@ bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CVali
|
||||||
// request; don't process these.
|
// request; don't process these.
|
||||||
if (pindex->nChainWork < nMinimumChainWork) return true;
|
if (pindex->nChainWork < nMinimumChainWork) return true;
|
||||||
}
|
}
|
||||||
if (fNewBlock) *fNewBlock = true;
|
|
||||||
|
|
||||||
if (!CheckBlock(block, state, chainparams.GetConsensus()) ||
|
if (!CheckBlock(block, state, chainparams.GetConsensus()) ||
|
||||||
!ContextualCheckBlock(block, state, chainparams.GetConsensus(), pindex->pprev)) {
|
!ContextualCheckBlock(block, state, chainparams.GetConsensus(), pindex->pprev)) {
|
||||||
|
@ -3530,6 +3529,7 @@ bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CVali
|
||||||
GetMainSignals().NewPoWValidBlock(pindex, pblock);
|
GetMainSignals().NewPoWValidBlock(pindex, pblock);
|
||||||
|
|
||||||
// Write block to history file
|
// Write block to history file
|
||||||
|
if (fNewBlock) *fNewBlock = true;
|
||||||
try {
|
try {
|
||||||
CDiskBlockPos blockPos = SaveBlockToDisk(block, pindex->nHeight, chainparams, dbp);
|
CDiskBlockPos blockPos = SaveBlockToDisk(block, pindex->nHeight, chainparams, dbp);
|
||||||
if (blockPos.IsNull()) {
|
if (blockPos.IsNull()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue