[#Chainstate-MaybeUpdateMempoolForReorg] = xref:Chainstate.adoc[Chainstate]::MaybeUpdateMempoolForReorg :relfileprefix: ../ :mrdocs: 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. == Synopsis Declared in `<validation.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[requires_capability(0x7ff37b9036c8, 0x7ff37b903740), requires_capability(0x7ff375c4a2d8, 0x7ff375c4a350), requires_capability(0x7ff37e055148, 0x7ff37e0551c0), requires_capability(0x7ff3759360a8, 0x7ff375936120)]] void MaybeUpdateMempoolForReorg( xref:DisconnectedBlockTransactions.adoc[DisconnectedBlockTransactions]& disconnectpool, bool fAddToMempool); ---- == Description 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. == Parameters [cols="1,4"] |=== | Name| Description | *disconnectpool* | Transactions from disconnected blocks to re‐add or erase. | *fAddToMempool* | Whether to try re‐adding the disconnected transactions. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#