Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 1,569 Lines • ▼ Show 20 Lines | static uint32_t GetBlockScriptFlags(const Config &config, | ||||
// alternative. We also start enforcing push only signatures and | // alternative. We also start enforcing push only signatures and | ||||
// clean stack. | // clean stack. | ||||
if (IsMagneticAnomalyEnabled(config, pChainTip)) { | if (IsMagneticAnomalyEnabled(config, pChainTip)) { | ||||
flags |= SCRIPT_ENABLE_CHECKDATASIG; | flags |= SCRIPT_ENABLE_CHECKDATASIG; | ||||
flags |= SCRIPT_VERIFY_SIGPUSHONLY; | flags |= SCRIPT_VERIFY_SIGPUSHONLY; | ||||
flags |= SCRIPT_VERIFY_CLEANSTACK; | flags |= SCRIPT_VERIFY_CLEANSTACK; | ||||
} | } | ||||
// If the Great Wall fork is enabled, we start accepting transactions | |||||
// recovering coins sent to segwit addresses | |||||
if (IsGreatWallEnabled(config, pChainTip)) { | |||||
flags |= SCRIPT_ALLOW_SEGWIT_RECOVERY; | |||||
} | |||||
// We make sure this node will have replay protection during the next hard | // We make sure this node will have replay protection during the next hard | ||||
// fork. | // fork. | ||||
if (IsReplayProtectionEnabled(config, pChainTip)) { | if (IsReplayProtectionEnabled(config, pChainTip)) { | ||||
flags |= SCRIPT_ENABLE_REPLAY_PROTECTION; | flags |= SCRIPT_ENABLE_REPLAY_PROTECTION; | ||||
} | } | ||||
return flags; | return flags; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 635 Lines • ▼ Show 20 Lines | if (IsReplayProtectionEnabled(config, pindexDelete) && | ||||
disconnectpool->clear(); | disconnectpool->clear(); | ||||
} | } | ||||
} | } | ||||
if (disconnectpool) { | if (disconnectpool) { | ||||
disconnectpool->addForBlock(block.vtx); | disconnectpool->addForBlock(block.vtx); | ||||
} | } | ||||
// If this block deactivates the Great wall fork, we remove and reintroduce | |||||
// all mempool entries we have | |||||
if (IsGreatWallEnabled(config, pindexDelete) && | |||||
!IsGreatWallEnabled(config, pindexDelete->pprev)) { | |||||
LogPrint(BCLog::MEMPOOL, "Reassessing mempool for reorg"); | |||||
std::vector<CTransactionRef> vtx; | |||||
vtx.reserve(g_mempool.mapTx.size()); | |||||
for (const CTxMemPoolEntry &e : g_mempool.mapTx) { | |||||
vtx.push_back(e.GetSharedTx()); | |||||
} | |||||
g_mempool.clear(); | |||||
disconnectpool->addForBlock(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; | ||||
} | } | ||||
// Update chainActive and related variables. | // Update chainActive and related variables. | ||||
UpdateTip(config, pindexDelete->pprev); | UpdateTip(config, pindexDelete->pprev); | ||||
// Let wallets know transactions went from 1-confirmed to | // Let wallets know transactions went from 1-confirmed to | ||||
▲ Show 20 Lines • Show All 3,297 Lines • Show Last 20 Lines |