aboutsummaryrefslogtreecommitdiff
path: root/src/validation.h
diff options
context:
space:
mode:
authorJames O'Beirne <james.obeirne@pm.me>2021-07-09 13:06:19 -0400
committerJames O'Beirne <james.obeirne@pm.me>2021-07-13 11:12:16 -0400
commit46e3efd1e4ae2f058ecfffdaee7e882c4305eb35 (patch)
treedc0f17b5617d2f467215bfcaef902f0f7481bef6 /src/validation.h
parent617661703ac29e0744f21de74501d033fdc53ff6 (diff)
downloadbitcoin-46e3efd1e4ae2f058ecfffdaee7e882c4305eb35.tar.xz
refactor: move UpdateMempoolForReorg into CChainState
Allows fewer arguments and simplification of call sites. Co-authored-by: John Newbery <john@johnnewbery.com>
Diffstat (limited to 'src/validation.h')
-rw-r--r--src/validation.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/validation.h b/src/validation.h
index 4823505cfc..68616f036a 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -808,6 +808,23 @@ private:
return m_mempool ? &m_mempool->cs : nullptr;
}
+ /**
+ * 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.
+ *
+ * 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.
+ */
+ void MaybeUpdateMempoolForReorg(
+ DisconnectedBlockTransactions& disconnectpool,
+ bool fAddToMempool) EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_mempool->cs);
+
friend ChainstateManager;
};