Bitcoin Core  27.99.0
P2P Digital Currency
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
CZMQNotificationInterface Class Referencefinal

#include <zmqnotificationinterface.h>

Inheritance diagram for CZMQNotificationInterface:
[legend]
Collaboration diagram for CZMQNotificationInterface:
[legend]

Public Member Functions

virtual ~CZMQNotificationInterface ()
 
std::list< const CZMQAbstractNotifier * > GetActiveNotifiers () const
 

Static Public Member Functions

static std::unique_ptr< CZMQNotificationInterfaceCreate (std::function< bool(std::vector< uint8_t > &, const CBlockIndex &)> get_block_by_index)
 

Protected Member Functions

bool Initialize ()
 
void Shutdown ()
 
void TransactionAddedToMempool (const NewMempoolTransactionInfo &tx, uint64_t mempool_sequence) override
 Notifies listeners of a transaction having been added to mempool. More...
 
void TransactionRemovedFromMempool (const CTransactionRef &tx, MemPoolRemovalReason reason, uint64_t mempool_sequence) override
 Notifies listeners of a transaction leaving mempool. More...
 
void BlockConnected (ChainstateRole role, const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexConnected) override
 Notifies listeners of a block being connected. More...
 
void BlockDisconnected (const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexDisconnected) override
 Notifies listeners of a block being disconnected Provides the block that was disconnected. More...
 
void UpdatedBlockTip (const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override
 Notifies listeners when the block chain tip advances. More...
 
- Protected Member Functions inherited from CValidationInterface
 ~CValidationInterface ()=default
 Protected destructor so that instances can only be deleted by derived classes. More...
 
virtual void MempoolTransactionsRemovedForBlock (const std::vector< RemovedMempoolTransactionInfo > &txs_removed_for_block, unsigned int nBlockHeight)
 
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...
 

Private Member Functions

 CZMQNotificationInterface ()
 

Private Attributes

void * pcontext {nullptr}
 
std::list< std::unique_ptr< CZMQAbstractNotifier > > notifiers
 

Detailed Description

Definition at line 22 of file zmqnotificationinterface.h.

Constructor & Destructor Documentation

◆ ~CZMQNotificationInterface()

CZMQNotificationInterface::~CZMQNotificationInterface ( )
virtual

Definition at line 31 of file zmqnotificationinterface.cpp.

Here is the call graph for this function:

◆ CZMQNotificationInterface()

CZMQNotificationInterface::CZMQNotificationInterface ( )
private

Definition at line 27 of file zmqnotificationinterface.cpp.

Here is the caller graph for this function:

Member Function Documentation

◆ BlockConnected()

void CZMQNotificationInterface::BlockConnected ( ChainstateRole  role,
const std::shared_ptr< const CBlock > &  block,
const CBlockIndex pindex 
)
overrideprotectedvirtual

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 from CValidationInterface.

Definition at line 181 of file zmqnotificationinterface.cpp.

Here is the call graph for this function:

◆ BlockDisconnected()

void CZMQNotificationInterface::BlockDisconnected ( const std::shared_ptr< const CBlock > &  block,
const CBlockIndex pindex 
)
overrideprotectedvirtual

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 from CValidationInterface.

Definition at line 199 of file zmqnotificationinterface.cpp.

Here is the call graph for this function:

◆ Create()

std::unique_ptr< CZMQNotificationInterface > CZMQNotificationInterface::Create ( std::function< bool(std::vector< uint8_t > &, const CBlockIndex &)>  get_block_by_index)
static

Definition at line 45 of file zmqnotificationinterface.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetActiveNotifiers()

std::list< const CZMQAbstractNotifier * > CZMQNotificationInterface::GetActiveNotifiers ( ) const

Definition at line 36 of file zmqnotificationinterface.cpp.

◆ Initialize()

bool CZMQNotificationInterface::Initialize ( )
protected

Definition at line 89 of file zmqnotificationinterface.cpp.

Here is the call graph for this function:

◆ Shutdown()

void CZMQNotificationInterface::Shutdown ( )
protected

Definition at line 119 of file zmqnotificationinterface.cpp.

Here is the caller graph for this function:

◆ TransactionAddedToMempool()

void CZMQNotificationInterface::TransactionAddedToMempool ( const NewMempoolTransactionInfo tx,
uint64_t  mempool_sequence 
)
overrideprotectedvirtual

Notifies listeners of a transaction having been added to mempool.

Called on a background thread.

Reimplemented from CValidationInterface.

Definition at line 162 of file zmqnotificationinterface.cpp.

Here is the call graph for this function:

◆ TransactionRemovedFromMempool()

void CZMQNotificationInterface::TransactionRemovedFromMempool ( const CTransactionRef tx,
MemPoolRemovalReason  reason,
uint64_t  mempool_sequence 
)
overrideprotectedvirtual

Notifies listeners of a transaction leaving mempool.

This notification fires for transactions that are removed from the mempool for the following reasons:

  • EXPIRY (expired from mempool after -mempoolexpiry hours)
  • SIZELIMIT (removed in size limiting if the mempool exceeds -maxmempool megabytes)
  • REORG (removed during a reorg)
  • CONFLICT (removed because it conflicts with in-block transaction)
  • REPLACED (removed due to RBF replacement)

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:

  • TransactionRemovedFromMempool(tx1 from block A)
  • TransactionRemovedFromMempool(tx2 from block A)
  • TransactionRemovedFromMempool(tx1 from block B)
  • TransactionRemovedFromMempool(tx2 from block B)
  • BlockConnected(A)
  • BlockConnected(B)

Called on a background thread.

Reimplemented from CValidationInterface.

Definition at line 171 of file zmqnotificationinterface.cpp.

Here is the call graph for this function:

◆ UpdatedBlockTip()

void CZMQNotificationInterface::UpdatedBlockTip ( const CBlockIndex pindexNew,
const CBlockIndex pindexFork,
bool  fInitialDownload 
)
overrideprotectedvirtual

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 from CValidationInterface.

Definition at line 152 of file zmqnotificationinterface.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ notifiers

std::list<std::unique_ptr<CZMQAbstractNotifier> > CZMQNotificationInterface::notifiers
private

Definition at line 46 of file zmqnotificationinterface.h.

◆ pcontext

void* CZMQNotificationInterface::pcontext {nullptr}
private

Definition at line 45 of file zmqnotificationinterface.h.


The documentation for this class was generated from the following files: