PIVX Core  5.6.99
P2P Digital Currency
Public Member Functions | Protected Member Functions | List of all members
CValidationInterface Class Reference

Implement this to subscribe to events generated in validation. More...

#include <validationinterface.h>

Inheritance diagram for CValidationInterface:
[legend]

Public Member Functions

virtual ~CValidationInterface ()=default
 
virtual void AcceptedBlockHeader (const CBlockIndex *pindexNew)
 

Protected Member Functions

virtual void UpdatedBlockTip (const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload)
 Notifies listeners when the block chain tip advances. More...
 
virtual void TransactionAddedToMempool (const CTransactionRef &ptxn)
 Notifies listeners of a transaction having been added to mempool. More...
 
virtual void TransactionRemovedFromMempool (const CTransactionRef &ptx, MemPoolRemovalReason reason)
 Notifies listeners of a transaction leaving mempool. More...
 
virtual void BlockConnected (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 uint256 &blockHash, int nBlockHeight, int64_t blockTime)
 Notifies listeners of a block being disconnected. More...
 
virtual void SetBestChain (const CBlockLocator &locator)
 Notifies listeners of the new active block chain on-disk. More...
 
virtual void ResendWalletTransactions (CConnman *connman)
 Tells listeners to broadcast their data. More...
 
virtual void BlockChecked (const CBlock &, const CValidationState &)
 
friend void ::RegisterSharedValidationInterface (std::shared_ptr< CValidationInterface >)
 
friend void ::UnregisterValidationInterface (CValidationInterface *)
 
friend void ::UnregisterAllValidationInterfaces ()
 
virtual void NotifyMasternodeListChanged (bool undo, const CDeterministicMNList &oldMNList, const CDeterministicMNListDiff &diff)
 Notifies listeners of updated deterministic masternode list. More...
 

Detailed Description

Implement this to subscribe to events generated in validation.

Each CValidationInterface() subscriber will receive event callbacks in the order in which the events were generated by validation. 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 81 of file validationinterface.h.

Constructor & Destructor Documentation

◆ ~CValidationInterface()

virtual CValidationInterface::~CValidationInterface ( )
virtualdefault

Member Function Documentation

◆ AcceptedBlockHeader()

virtual void CValidationInterface::AcceptedBlockHeader ( const CBlockIndex pindexNew)
inlinevirtual

Reimplemented in EvoNotificationInterface.

Definition at line 84 of file validationinterface.h.

◆ BlockChecked()

virtual void CValidationInterface::BlockChecked ( const CBlock ,
const CValidationState  
)
inlineprotectedvirtual

Reimplemented in BlockStateCatcher, and PeerLogicValidation.

Definition at line 157 of file validationinterface.h.

◆ BlockConnected()

virtual void CValidationInterface::BlockConnected ( const std::shared_ptr< const CBlock > &  block,
const CBlockIndex pindex 
)
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 CZMQNotificationInterface, CWallet, PeerLogicValidation, and TestSubscriber.

Definition at line 142 of file validationinterface.h.

◆ BlockDisconnected()

virtual void CValidationInterface::BlockDisconnected ( const std::shared_ptr< const CBlock > &  block,
const uint256 blockHash,
int  nBlockHeight,
int64_t  blockTime 
)
inlineprotectedvirtual

Notifies listeners of a block being disconnected.

Called on a background thread.

Reimplemented in CZMQNotificationInterface, CWallet, and TestSubscriber.

Definition at line 148 of file validationinterface.h.

◆ NotifyMasternodeListChanged()

virtual void CValidationInterface::NotifyMasternodeListChanged ( bool  undo,
const CDeterministicMNList oldMNList,
const CDeterministicMNListDiff diff 
)
inlineprotectedvirtual

Notifies listeners of updated deterministic masternode list.

Reimplemented in EvoNotificationInterface.

Definition at line 162 of file validationinterface.h.

◆ ResendWalletTransactions()

virtual void CValidationInterface::ResendWalletTransactions ( CConnman connman)
inlineprotectedvirtual

Tells listeners to broadcast their data.

Reimplemented in CWallet.

Definition at line 156 of file validationinterface.h.

◆ SetBestChain()

virtual void CValidationInterface::SetBestChain ( const CBlockLocator locator)
inlineprotectedvirtual

Notifies listeners of the new active block chain on-disk.

Called on a background thread.

Reimplemented in CWallet.

Definition at line 154 of file validationinterface.h.

◆ TransactionAddedToMempool()

virtual void CValidationInterface::TransactionAddedToMempool ( const CTransactionRef ptxn)
inlineprotectedvirtual

Notifies listeners of a transaction having been added to mempool.

Called on a background thread.

Reimplemented in CZMQNotificationInterface, and CWallet.

Definition at line 102 of file validationinterface.h.

◆ TransactionRemovedFromMempool()

virtual void CValidationInterface::TransactionRemovedFromMempool ( const CTransactionRef ptx,
MemPoolRemovalReason  reason 
)
inlineprotectedvirtual

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) – not supported yet –

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 BlockConnected 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 in CWallet.

Definition at line 135 of file validationinterface.h.

◆ UpdatedBlockTip()

virtual void CValidationInterface::UpdatedBlockTip ( const CBlockIndex pindexNew,
const CBlockIndex pindexFork,
bool  fInitialDownload 
)
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.

Reimplemented in CZMQNotificationInterface, CWallet, PeerLogicValidation, CMasternodePayments, EvoNotificationInterface, CBudgetManager, CActiveDeterministicMasternodeManager, and TestSubscriber.

Definition at line 96 of file validationinterface.h.

◆ void ::RegisterSharedValidationInterface()

CValidationInterface::void ::RegisterSharedValidationInterface ( std::shared_ptr< CValidationInterface )
protected

◆ void ::UnregisterAllValidationInterfaces()

CValidationInterface::void ::UnregisterAllValidationInterfaces ( )
protected

◆ void ::UnregisterValidationInterface()

CValidationInterface::void ::UnregisterValidationInterface ( CValidationInterface )
protected

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