aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.h
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2021-09-29 20:52:04 +0100
committerglozow <gloriajzhao@gmail.com>2021-11-30 12:21:56 +0000
commita64078e38563ef3ac5e5ec20c07569441c87eeee (patch)
tree3a4968f341333b819884b28e94f74007fd24c1fe /src/txmempool.h
parent64e4963c635ec3a73a5fa3f32f6ec08e70609f60 (diff)
downloadbitcoin-a64078e38563ef3ac5e5ec20c07569441c87eeee.tar.xz
Break validation <-> txmempool circular dependency
No behavior change. Parameterize removeForReorg using a CChain and callable that encapsulates validation logic. The mempool shouldn't need to know a bunch of details about coinbase maturity and lock finality. Instead, just pass in a callable function that says true/false. Breaks circular dependency by removing txmempool's dependency on validation.
Diffstat (limited to 'src/txmempool.h')
-rw-r--r--src/txmempool.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/txmempool.h b/src/txmempool.h
index 412c2fbb74..c6e08a3ca5 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -589,7 +589,10 @@ public:
void addUnchecked(const CTxMemPoolEntry& entry, setEntries& setAncestors, bool validFeeEstimate = true) EXCLUSIVE_LOCKS_REQUIRED(cs, cs_main);
void removeRecursive(const CTransaction& tx, MemPoolRemovalReason reason) EXCLUSIVE_LOCKS_REQUIRED(cs);
- void removeForReorg(CChainState& active_chainstate, int flags) EXCLUSIVE_LOCKS_REQUIRED(cs, cs_main);
+ /** After reorg, check if mempool entries are now non-final, premature coinbase spends, or have
+ * invalid lockpoints. Update lockpoints and remove entries (and descendants of entries) that
+ * are no longer valid. */
+ void removeForReorg(CChain& chain, std::function<bool(txiter)> check_final_and_mature) EXCLUSIVE_LOCKS_REQUIRED(cs, cs_main);
void removeConflicts(const CTransaction& tx) EXCLUSIVE_LOCKS_REQUIRED(cs);
void removeForBlock(const std::vector<CTransactionRef>& vtx, unsigned int nBlockHeight) EXCLUSIVE_LOCKS_REQUIRED(cs);