Bitcoin Core  0.19.99
P2P Digital Currency
zmqnotificationinterface.h
Go to the documentation of this file.
1 // Copyright (c) 2015-2019 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_ZMQ_ZMQNOTIFICATIONINTERFACE_H
6 #define BITCOIN_ZMQ_ZMQNOTIFICATIONINTERFACE_H
7 
8 #include <validationinterface.h>
9 #include <list>
10 
11 class CBlockIndex;
13 
15 {
16 public:
18 
19  std::list<const CZMQAbstractNotifier*> GetActiveNotifiers() const;
20 
22 
23 protected:
24  bool Initialize();
25  void Shutdown();
26 
27  // CValidationInterface
28  void TransactionAddedToMempool(const CTransactionRef& tx) override;
29  void BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexConnected) override;
30  void BlockDisconnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexDisconnected) override;
31  void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override;
32 
33 private:
35 
36  void *pcontext;
37  std::list<CZMQAbstractNotifier*> notifiers;
38 };
39 
41 
42 #endif // BITCOIN_ZMQ_ZMQNOTIFICATIONINTERFACE_H
std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:408
void BlockDisconnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexDisconnected) override
Notifies listeners of a block being disconnected.
void TransactionAddedToMempool(const CTransactionRef &tx) override
Notifies listeners of a transaction having been added to mempool.
Implement this to subscribe to events generated in validation.
static CZMQNotificationInterface * Create()
void BlockConnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexConnected) override
Notifies listeners of a block being connected.
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override
Notifies listeners when the block chain tip advances.
std::list< CZMQAbstractNotifier * > notifiers
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:137
CZMQNotificationInterface * g_zmq_notification_interface
std::list< const CZMQAbstractNotifier * > GetActiveNotifiers() const