mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-19 13:27:35 +02:00
[validation] Always call mempool.check() after processing a new transaction
CTxMemPool::check() will carry out internal consistency checks 1/n times, where n is set by the `-checkmempool` configuration option. By default, mempool consistency checks are disabled entirely on mainnet. Therefore, this change has no effect on mainnet nodes running with default configuration. It simply removes the responsibility to trigger mempool consistency checks from net_processing.
This commit is contained in:
parent
2c64270bbe
commit
0fdb619aaf
2 changed files with 3 additions and 5 deletions
|
|
@ -2300,8 +2300,6 @@ void PeerManagerImpl::ProcessOrphanTx(std::set<uint256>& orphan_work_set)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CChainState& active_chainstate = m_chainman.ActiveChainstate();
|
|
||||||
m_mempool.check(active_chainstate.CoinsTip(), active_chainstate.m_chain.Height() + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PeerManagerImpl::PrepareBlockFilterRequest(CNode& peer,
|
bool PeerManagerImpl::PrepareBlockFilterRequest(CNode& peer,
|
||||||
|
|
@ -3264,8 +3262,6 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||||
const TxValidationState& state = result.m_state;
|
const TxValidationState& state = result.m_state;
|
||||||
|
|
||||||
if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
|
if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
|
||||||
CChainState& active_chainstate = m_chainman.ActiveChainstate();
|
|
||||||
m_mempool.check(active_chainstate.CoinsTip(), active_chainstate.m_chain.Height() + 1);
|
|
||||||
// As this version of the transaction was acceptable, we can forget about any
|
// As this version of the transaction was acceptable, we can forget about any
|
||||||
// requests for it.
|
// requests for it.
|
||||||
m_txrequest.ForgetTxHash(tx.GetHash());
|
m_txrequest.ForgetTxHash(tx.GetHash());
|
||||||
|
|
|
||||||
|
|
@ -3429,7 +3429,9 @@ MempoolAcceptResult ChainstateManager::ProcessTransaction(const CTransactionRef&
|
||||||
state.Invalid(TxValidationResult::TX_NO_MEMPOOL, "no-mempool");
|
state.Invalid(TxValidationResult::TX_NO_MEMPOOL, "no-mempool");
|
||||||
return MempoolAcceptResult::Failure(state);
|
return MempoolAcceptResult::Failure(state);
|
||||||
}
|
}
|
||||||
return AcceptToMemoryPool(active_chainstate, *active_chainstate.m_mempool, tx, /*bypass_limits=*/ false, test_accept);
|
auto result = AcceptToMemoryPool(active_chainstate, *active_chainstate.m_mempool, tx, /*bypass_limits=*/ false, test_accept);
|
||||||
|
active_chainstate.m_mempool->check(active_chainstate.CoinsTip(), active_chainstate.m_chain.Height() + 1);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TestBlockValidity(BlockValidationState& state,
|
bool TestBlockValidity(BlockValidationState& state,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue