Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 2,833 Lines • ▼ Show 20 Lines | do { | ||||
if (fInvalidChain || fParkedChain) { | if (fInvalidChain || fParkedChain) { | ||||
// We discovered a new chain tip that is either parked or | // We discovered a new chain tip that is either parked or | ||||
// invalid, we may want to warn. | // invalid, we may want to warn. | ||||
CheckForkWarningConditionsOnNewFork(pindexNew); | CheckForkWarningConditionsOnNewFork(pindexNew); | ||||
} | } | ||||
} | } | ||||
if (g_avalanche && pindexNew->nStatus.isOnParkedChain() && | |||||
gArgs.GetBoolArg("-enableavalanche", AVALANCHE_DEFAULT_ENABLED)) { | |||||
g_avalanche->addBlockToReconcile(pindexNew); | |||||
} | |||||
// We found a candidate that has valid ancestors. This is our guy. | // We found a candidate that has valid ancestors. This is our guy. | ||||
if (hasValidAncestor) { | if (hasValidAncestor) { | ||||
return pindexNew; | return pindexNew; | ||||
} | } | ||||
} while (true); | } while (true); | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 1,415 Lines • ▼ Show 20 Lines | bool CChainState::AcceptBlock(const Config &config, | ||||
// needed. | // needed. | ||||
if (gArgs.GetBoolArg("-parkdeepreorg", true)) { | if (gArgs.GetBoolArg("-parkdeepreorg", true)) { | ||||
const CBlockIndex *pindexFork = m_chain.FindFork(pindex); | const CBlockIndex *pindexFork = m_chain.FindFork(pindex); | ||||
if (pindexFork && pindexFork->nHeight + 1 < m_chain.Height()) { | if (pindexFork && pindexFork->nHeight + 1 < m_chain.Height()) { | ||||
LogPrintf("Park block %s as it would cause a deep reorg.\n", | LogPrintf("Park block %s as it would cause a deep reorg.\n", | ||||
pindex->GetBlockHash().ToString()); | pindex->GetBlockHash().ToString()); | ||||
pindex->nStatus = pindex->nStatus.withParked(); | pindex->nStatus = pindex->nStatus.withParked(); | ||||
setDirtyBlockIndex.insert(pindex); | setDirtyBlockIndex.insert(pindex); | ||||
if (g_avalanche && | |||||
pindex->nChainWork >= m_chain.Tip()->nChainWork) { | |||||
g_avalanche->addBlockToReconcile(pindex); | |||||
} | |||||
} | } | ||||
} | } | ||||
// Header is valid/has work and the merkle tree is good. | // Header is valid/has work and the merkle tree is good. | ||||
// Relay now, but if it does not build on our best tip, let the | // Relay now, but if it does not build on our best tip, let the | ||||
// SendMessages loop relay it. | // SendMessages loop relay it. | ||||
if (!IsInitialBlockDownload() && m_chain.Tip() == pindex->pprev) { | if (!IsInitialBlockDownload() && m_chain.Tip() == pindex->pprev) { | ||||
GetMainSignals().NewPoWValidBlock(pindex, pblock); | GetMainSignals().NewPoWValidBlock(pindex, pblock); | ||||
▲ Show 20 Lines • Show All 1,635 Lines • Show Last 20 Lines |