Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
Show First 20 Lines • Show All 578 Lines • ▼ Show 20 Lines | void CTxMemPool::removeForReorg(const Config &config, | ||||
// no-longer-final transactions. | // no-longer-final transactions. | ||||
AssertLockHeld(cs); | AssertLockHeld(cs); | ||||
setEntries txToRemove; | setEntries txToRemove; | ||||
for (indexed_transaction_set::const_iterator it = mapTx.begin(); | for (indexed_transaction_set::const_iterator it = mapTx.begin(); | ||||
it != mapTx.end(); it++) { | it != mapTx.end(); it++) { | ||||
const CTransaction &tx = it->GetTx(); | const CTransaction &tx = it->GetTx(); | ||||
LockPoints lp = it->GetLockPoints(); | LockPoints lp = it->GetLockPoints(); | ||||
bool validLP = TestLockPointValidity(active_chainstate.m_chain, &lp); | bool validLP = TestLockPointValidity(active_chainstate.m_chain, &lp); | ||||
CCoinsViewMemPool viewMempool(&active_chainstate.CoinsTip(), *this); | |||||
TxValidationState state; | TxValidationState state; | ||||
if (!ContextualCheckTransactionForCurrentBlock( | if (!ContextualCheckTransactionForCurrentBlock( | ||||
active_chainstate.m_chain.Tip(), | active_chainstate.m_chain.Tip(), | ||||
config.GetChainParams().GetConsensus(), tx, state, flags) || | config.GetChainParams().GetConsensus(), tx, state, flags) || | ||||
!CheckSequenceLocks(active_chainstate, *this, tx, flags, &lp, | !CheckSequenceLocks(active_chainstate.m_chain.Tip(), viewMempool, | ||||
validLP)) { | tx, flags, &lp, validLP)) { | ||||
// Note if CheckSequenceLocks fails the LockPoints may still be | // Note if CheckSequenceLocks fails the LockPoints may still be | ||||
// invalid. So it's critical that we remove the tx and not depend on | // invalid. So it's critical that we remove the tx and not depend on | ||||
// the LockPoints. | // the LockPoints. | ||||
txToRemove.insert(it); | txToRemove.insert(it); | ||||
} else if (it->GetSpendsCoinbase()) { | } else if (it->GetSpendsCoinbase()) { | ||||
for (const CTxIn &txin : tx.vin) { | for (const CTxIn &txin : tx.vin) { | ||||
indexed_transaction_set::const_iterator it2 = | indexed_transaction_set::const_iterator it2 = | ||||
mapTx.find(txin.prevout.GetTxId()); | mapTx.find(txin.prevout.GetTxId()); | ||||
▲ Show 20 Lines • Show All 853 Lines • Show Last 20 Lines |