Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 2,272 Lines • ▼ Show 20 Lines | bool CChainState::DisconnectTip(const Config &config, CValidationState &state, | ||||
if (!FlushStateToDisk(config.GetChainParams(), state, | if (!FlushStateToDisk(config.GetChainParams(), state, | ||||
FlushStateMode::IF_NEEDED)) { | FlushStateMode::IF_NEEDED)) { | ||||
return false; | return false; | ||||
} | } | ||||
// If this block is deactivating a fork, we move all mempool transactions | // If this block is deactivating a fork, we move all mempool transactions | ||||
// in front of disconnectpool for reprocessing in a future | // in front of disconnectpool for reprocessing in a future | ||||
// updateMempoolForReorg call | // updateMempoolForReorg call | ||||
if (pindexDelete->pprev != nullptr && | if (pindexDelete->pprev != nullptr) { | ||||
GetNextBlockScriptFlags(consensusParams, pindexDelete) != | bool changes = false; | ||||
GetNextBlockScriptFlags(consensusParams, pindexDelete->pprev)) { | changes |= | ||||
(GetNextBlockScriptFlags(consensusParams, pindexDelete) != | |||||
GetNextBlockScriptFlags(consensusParams, pindexDelete->pprev)); | |||||
changes |= | |||||
(GetDefaultAncestorLimit(consensusParams, pindexDelete) != | |||||
GetDefaultAncestorLimit(consensusParams, pindexDelete->pprev)); | |||||
changes |= | |||||
(GetDefaultDecendantLimit(consensusParams, pindexDelete) != | |||||
GetDefaultDecendantLimit(consensusParams, pindexDelete->pprev)); | |||||
if (changes) { | |||||
LogPrint(BCLog::MEMPOOL, | LogPrint(BCLog::MEMPOOL, | ||||
"Disconnecting mempool due to rewind of upgrade block\n"); | "Disconnecting mempool due to rewind of upgrade block\n"); | ||||
if (disconnectpool) { | if (disconnectpool) { | ||||
disconnectpool->importMempool(g_mempool); | disconnectpool->importMempool(g_mempool); | ||||
} | } | ||||
g_mempool.clear(); | g_mempool.clear(); | ||||
} | } | ||||
} | |||||
if (disconnectpool) { | if (disconnectpool) { | ||||
disconnectpool->addForBlock(block.vtx); | disconnectpool->addForBlock(block.vtx); | ||||
} | } | ||||
// If the tip is finalized, then undo it. | // If the tip is finalized, then undo it. | ||||
if (pindexFinalized == pindexDelete) { | if (pindexFinalized == pindexDelete) { | ||||
pindexFinalized = pindexDelete->pprev; | pindexFinalized = pindexDelete->pprev; | ||||
▲ Show 20 Lines • Show All 3,497 Lines • Show Last 20 Lines |