Make mempool consistent after a reorg, by re-adding or recursively erasing disconnected block transactions from the mempool, and also removing any other transactions from the mempool that are no longer valid given the new tip/height.
Declared in <validation.h>
[[requires_capability(0x7fb95fa39768, 0x7fb95fa397e0), requires_capability(0x7fb96ac606c8, 0x7fb96ac60740), requires_capability(0x7fb96e9d6ee8, 0x7fb96e9d6f60), requires_capability(0x7fb98748c558, 0x7fb98748c5d0)]]
void
MaybeUpdateMempoolForReorg(
DisconnectedBlockTransactions& disconnectpool,
bool fAddToMempool);
Note: we assume that disconnectpool only contains transactions that are NOT confirmed in the current chain nor already in the mempool (otherwise, in-mempool descendants of such transactions would be removed).
Passing fAddToMempool=false will skip trying to add the transactions back, and instead just erase from the mempool as needed.
| Name | Description |
|---|---|
| disconnectpool | Transactions from disconnected blocks to re-add or erase. |
| fAddToMempool | Whether to try re-adding the disconnected transactions. |