Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 2,333 Lines • ▼ Show 20 Lines | static bool FinalizeBlockInternal(const Config &config, CValidationState &state, | ||||
if (pindexFinalized && !AreOnTheSameFork(pindex, pindexFinalized)) { | if (pindexFinalized && !AreOnTheSameFork(pindex, pindexFinalized)) { | ||||
return state.DoS( | return state.DoS( | ||||
20, error("%s: Trying to finalize block %s which conflicts " | 20, error("%s: Trying to finalize block %s which conflicts " | ||||
"with already finalized block", | "with already finalized block", | ||||
__func__, pindex->GetBlockHash().ToString()), | __func__, pindex->GetBlockHash().ToString()), | ||||
REJECT_AGAINST_FINALIZED, "bad-fork-prior-finalized"); | REJECT_AGAINST_FINALIZED, "bad-fork-prior-finalized"); | ||||
} | } | ||||
// Our candidate is valid, finalize it. | if (IsBlockFinalized(pindex)) { | ||||
// The block is already finalized. | |||||
return true; | |||||
} | |||||
// We have a new block to finalize. | |||||
pindexFinalized = pindex; | pindexFinalized = pindex; | ||||
return true; | return true; | ||||
} | } | ||||
/** | /** | ||||
* Connect a new block to chainActive. pblock is either nullptr or a pointer to | * Connect a new block to chainActive. pblock is either nullptr or a pointer to | ||||
* a CBlock corresponding to pindexNew, to bypass loading it again from disk. | * a CBlock corresponding to pindexNew, to bypass loading it again from disk. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 3,126 Lines • Show Last 20 Lines |