diff options
author | Matt Corallo <git@bluematt.me> | 2017-01-20 15:08:14 -0500 |
---|---|---|
committer | Matt Corallo <git@bluematt.me> | 2017-10-13 19:29:54 -0400 |
commit | a7d3936de8418522dbb161bfef31c234fc6c2503 (patch) | |
tree | 7b14bdfffb142c4097a8abee0ccb58c1498f591f /src/validationinterface.h | |
parent | 326a5652e0d25fdb60c337ef4f1c98a63e0748f0 (diff) |
Add a CValidationInterface::TransactionRemovedFromMempool
This is currently unused, but will by used by wallet to cache when
transactions are in the mempool, obviating the need for calls to
mempool from CWalletTx::InMempool()
Diffstat (limited to 'src/validationinterface.h')
-rw-r--r-- | src/validationinterface.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/validationinterface.h b/src/validationinterface.h index d6da2bc1fd..915c17695e 100644 --- a/src/validationinterface.h +++ b/src/validationinterface.h @@ -20,6 +20,8 @@ class CValidationInterface; class CValidationState; class uint256; class CScheduler; +class CTxMemPool; +enum class MemPoolRemovalReason; // These functions dispatch to one or all registered wallets @@ -37,6 +39,15 @@ protected: /** Notifies listeners of a transaction having been added to mempool. */ virtual void TransactionAddedToMempool(const CTransactionRef &ptxn) {} /** + * Notifies listeners of a transaction leaving mempool. + * + * This only fires for transactions which leave mempool because of expiry, + * size limiting, reorg (changes in lock times/coinbase maturity), or + * replacement. This does not include any transactions which are included + * in BlockConnectedDisconnected either in block->vtx or in txnConflicted. + */ + virtual void TransactionRemovedFromMempool(const CTransactionRef &ptx) {} + /** * Notifies listeners of a block being connected. * Provides a vector of transactions evicted from the mempool as a result. */ @@ -74,6 +85,8 @@ private: friend void ::UnregisterValidationInterface(CValidationInterface*); friend void ::UnregisterAllValidationInterfaces(); + void MempoolEntryRemoved(CTransactionRef tx, MemPoolRemovalReason reason); + public: /** Register a CScheduler to give callbacks which should run in the background (may only be called once) */ void RegisterBackgroundSignalScheduler(CScheduler& scheduler); @@ -82,6 +95,11 @@ public: /** Call any remaining callbacks on the calling thread */ void FlushBackgroundCallbacks(); + /** Register with mempool to call TransactionRemovedFromMempool callbacks */ + void RegisterWithMempoolSignals(CTxMemPool& pool); + /** Unregister with mempool */ + void UnregisterWithMempoolSignals(CTxMemPool& pool); + void UpdatedBlockTip(const CBlockIndex *, const CBlockIndex *, bool fInitialDownload); void TransactionAddedToMempool(const CTransactionRef &); void BlockConnected(const std::shared_ptr<const CBlock> &, const CBlockIndex *pindex, const std::vector<CTransactionRef> &); |