mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
[mempool] sanity check that all unbroadcast txns are in mempool
- before reattempting broadcast for unbroadcast txns, check they are in mempool and remove if not - this protects from memory leaks and network spam just in case unbroadcast set (incorrectly) has extra txns - check that tx is in mempool before adding to unbroadcast set to try to prevent this from happening
This commit is contained in:
parent
a7ebe48b94
commit
9d3f7eb986
2 changed files with 10 additions and 2 deletions
|
|
@ -819,7 +819,12 @@ void PeerLogicValidation::ReattemptInitialBroadcast(CScheduler& scheduler) const
|
|||
std::set<uint256> unbroadcast_txids = m_mempool.GetUnbroadcastTxs();
|
||||
|
||||
for (const uint256& txid : unbroadcast_txids) {
|
||||
RelayTransaction(txid, *connman);
|
||||
// Sanity check: all unbroadcast txns should exist in the mempool
|
||||
if (m_mempool.exists(txid)) {
|
||||
RelayTransaction(txid, *connman);
|
||||
} else {
|
||||
m_mempool.RemoveUnbroadcastTx(txid, true);
|
||||
}
|
||||
}
|
||||
|
||||
// schedule next run for 10-15 minutes in the future
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue