Merge bitcoin/bitcoin#24145: mempool: Clear vTxHashes when mapTx is cleared

9d65ad365c Clear vTxHashes when mapTx is cleared (Peter Bushnell)

Pull request description:

  vTxHashes is a vector of all entries in mapTx, if you clear one you should clear the other, lest someone try to use the txiter in vTxHashes which would result in a segfault.

ACKs for top commit:
  laanwj:
    Code review ACK 9d65ad365c

Tree-SHA512: 6832755e43ab7f528b46817aeadcb6ffdc965b97f59ab96bb053dedbb7e68155ba3db52286355dca33b509237f80eda249760b26db493762bc50d8e2cef16d8f
24.x
laanwj 3 years ago
commit bbb83f0b2b
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D

@ -694,6 +694,7 @@ void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& vtx, unsigne
void CTxMemPool::_clear()
{
vTxHashes.clear();
mapTx.clear();
mapNextTx.clear();
totalTxSize = 0;

Loading…
Cancel
Save