Bitcoin Core 28.99.0
P2P Digital Currency
|
Implement this to subscribe to events generated in validation and mempool. More...
#include <validationinterface.h>
Protected Member Functions | |
~CValidationInterface ()=default | |
Protected destructor so that instances can only be deleted by derived classes. More... | |
virtual void | UpdatedBlockTip (const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) |
Notifies listeners when the block chain tip advances. More... | |
virtual void | ActiveTipChange (const CBlockIndex &new_tip, bool is_ibd) |
Notifies listeners any time the block chain tip changes, synchronously. More... | |
virtual void | TransactionAddedToMempool (const NewMempoolTransactionInfo &tx, uint64_t mempool_sequence) |
Notifies listeners of a transaction having been added to mempool. More... | |
virtual void | TransactionRemovedFromMempool (const CTransactionRef &tx, MemPoolRemovalReason reason, uint64_t mempool_sequence) |
Notifies listeners of a transaction leaving mempool. More... | |
virtual void | MempoolTransactionsRemovedForBlock (const std::vector< RemovedMempoolTransactionInfo > &txs_removed_for_block, unsigned int nBlockHeight) |
virtual void | BlockConnected (ChainstateRole role, const std::shared_ptr< const CBlock > &block, const CBlockIndex *pindex) |
Notifies listeners of a block being connected. More... | |
virtual void | BlockDisconnected (const std::shared_ptr< const CBlock > &block, const CBlockIndex *pindex) |
Notifies listeners of a block being disconnected Provides the block that was disconnected. More... | |
virtual void | ChainStateFlushed (ChainstateRole role, const CBlockLocator &locator) |
Notifies listeners of the new active block chain on-disk. More... | |
virtual void | BlockChecked (const CBlock &, const BlockValidationState &) |
Notifies listeners of a block validation result. More... | |
virtual void | NewPoWValidBlock (const CBlockIndex *pindex, const std::shared_ptr< const CBlock > &block) |
Notifies listeners that a block which builds directly on our current tip has been received and connected to the headers tree, though not validated yet. More... | |
Friends | |
class | ValidationSignals |
class | ValidationInterfaceTest |
Implement this to subscribe to events generated in validation and mempool.
Each CValidationInterface() subscriber will receive event callbacks in the order in which the events were generated by validation and mempool. Furthermore, each ValidationInterface() subscriber may assume that callbacks effectively run in a single thread with single-threaded memory consistency. That is, for a given ValidationInterface() instantiation, each callback will complete before the next one is invoked. This means, for example when a block is connected that the UpdatedBlockTip() callback may depend on an operation performed in the BlockConnected() callback without worrying about explicit synchronization. No ordering should be assumed across ValidationInterface() subscribers.
Definition at line 47 of file validationinterface.h.
|
protecteddefault |
Protected destructor so that instances can only be deleted by derived classes.
If that restriction is no longer desired, this should be made public and virtual.
|
inlineprotectedvirtual |
Notifies listeners any time the block chain tip changes, synchronously.
Definition at line 67 of file validationinterface.h.
|
inlineprotectedvirtual |
Notifies listeners of a block validation result.
If the provided BlockValidationState IsValid, the provided block is guaranteed to be the current best block at the time the callback was generated (not necessarily now).
Reimplemented in TestSubscriberNoop, BlockValidationStateCatcher, TestInterface, and submitblock_StateCatcher.
Definition at line 154 of file validationinterface.h.
|
inlineprotectedvirtual |
Notifies listeners of a block being connected.
Provides a vector of transactions evicted from the mempool as a result.
Called on a background thread.
Reimplemented in BaseIndex, TestSubscriber, and CZMQNotificationInterface.
Definition at line 122 of file validationinterface.h.
|
inlineprotectedvirtual |
Notifies listeners of a block being disconnected Provides the block that was disconnected.
Called on a background thread. Only called for the active chainstate, since background chainstates should never disconnect blocks.
Reimplemented in TestSubscriber, and CZMQNotificationInterface.
Definition at line 130 of file validationinterface.h.
|
inlineprotectedvirtual |
Notifies listeners of the new active block chain on-disk.
Prior to this callback, any updates are not guaranteed to persist on disk (ie clients need to handle shutdown/restart safety by being able to understand when some updates were lost due to unclean shutdown).
When this callback is invoked, the validation changes done by any prior callback are guaranteed to exist on disk and survive a restart, including an unclean shutdown.
Provides a locator describing the best chain, which is likely useful for storing current state on disk in client DBs.
Called on a background thread.
Reimplemented in BaseIndex.
Definition at line 147 of file validationinterface.h.
|
inlineprotectedvirtual |
Reimplemented in CBlockPolicyEstimator.
Definition at line 115 of file validationinterface.h.
|
inlineprotectedvirtual |
Notifies listeners that a block which builds directly on our current tip has been received and connected to the headers tree, though not validated yet.
Definition at line 159 of file validationinterface.h.
|
inlineprotectedvirtual |
Notifies listeners of a transaction having been added to mempool.
Called on a background thread.
Reimplemented in CZMQNotificationInterface, and CBlockPolicyEstimator.
Definition at line 73 of file validationinterface.h.
|
inlineprotectedvirtual |
Notifies listeners of a transaction leaving mempool.
This notification fires for transactions that are removed from the mempool for the following reasons:
This does not fire for transactions that are removed from the mempool because they have been included in a block. Any client that is interested in transactions removed from the mempool for inclusion in a block can learn about those transactions from the MempoolTransactionsRemovedForBlock notification.
Transactions that are removed from the mempool because they conflict with a transaction in the new block will have TransactionRemovedFromMempool events fired before the BlockConnected event is fired. If multiple blocks are connected in one step, then the ordering could be:
Called on a background thread.
Reimplemented in CZMQNotificationInterface, and CBlockPolicyEstimator.
Definition at line 107 of file validationinterface.h.
|
inlineprotectedvirtual |
Notifies listeners when the block chain tip advances.
When multiple blocks are connected at once, UpdatedBlockTip will be called on the final tip but may not be called on every intermediate tip. If the latter behavior is desired, subscribe to BlockConnected() instead.
Called on a background thread. Only called for the active chainstate.
Reimplemented in TestSubscriber, and CZMQNotificationInterface.
Definition at line 63 of file validationinterface.h.
|
friend |
Definition at line 161 of file validationinterface.h.
|
friend |
Definition at line 160 of file validationinterface.h.