Bitcoin ABC  0.24.7
P2P Digital Currency
zmqnotificationinterface.h
Go to the documentation of this file.
1 // Copyright (c) 2015-2018 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 
10 #include <list>
11 #include <memory>
12 
13 class CBlockIndex;
15 
17 public:
19 
20  std::list<const CZMQAbstractNotifier *> GetActiveNotifiers() const;
21 
23 
24 protected:
25  bool Initialize();
26  void Shutdown();
27 
28  // CValidationInterface
30  uint64_t mempool_sequence) override;
32  MemPoolRemovalReason reason,
33  uint64_t mempool_sequence) override;
34  void BlockConnected(const std::shared_ptr<const CBlock> &pblock,
35  const CBlockIndex *pindexConnected) override;
36  void BlockDisconnected(const std::shared_ptr<const CBlock> &pblock,
37  const CBlockIndex *pindexDisconnected) override;
38  void UpdatedBlockTip(const CBlockIndex *pindexNew,
39  const CBlockIndex *pindexFork,
40  bool fInitialDownload) override;
41 
42 private:
44 
45  void *pcontext;
46  std::list<std::unique_ptr<CZMQAbstractNotifier>> notifiers;
47 };
48 
50 
51 #endif // BITCOIN_ZMQ_ZMQNOTIFICATIONINTERFACE_H
CValidationInterface
Implement this to subscribe to events generated in validation.
Definition: validationinterface.h:83
CZMQNotificationInterface::CZMQNotificationInterface
CZMQNotificationInterface()
Definition: zmqnotificationinterface.cpp:14
g_zmq_notification_interface
CZMQNotificationInterface * g_zmq_notification_interface
Definition: zmqnotificationinterface.cpp:207
CZMQNotificationInterface::pcontext
void * pcontext
Definition: zmqnotificationinterface.h:45
CZMQNotificationInterface::Create
static CZMQNotificationInterface * Create()
Definition: zmqnotificationinterface.cpp:29
CZMQNotificationInterface::BlockConnected
void BlockConnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexConnected) override
Notifies listeners of a block being connected.
Definition: zmqnotificationinterface.cpp:171
validationinterface.h
CZMQAbstractNotifier
Definition: zmqabstractnotifier.h:17
CZMQNotificationInterface::Shutdown
void Shutdown()
Definition: zmqnotificationinterface.cpp:101
CZMQNotificationInterface::BlockDisconnected
void BlockDisconnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexDisconnected) override
Notifies listeners of a block being disconnected.
Definition: zmqnotificationinterface.cpp:189
CZMQNotificationInterface::TransactionRemovedFromMempool
void TransactionRemovedFromMempool(const CTransactionRef &tx, MemPoolRemovalReason reason, uint64_t mempool_sequence) override
Notifies listeners of a transaction leaving mempool.
Definition: zmqnotificationinterface.cpp:159
CZMQNotificationInterface::TransactionAddedToMempool
void TransactionAddedToMempool(const CTransactionRef &tx, uint64_t mempool_sequence) override
Notifies listeners of a transaction having been added to mempool.
Definition: zmqnotificationinterface.cpp:148
CZMQNotificationInterface::GetActiveNotifiers
std::list< const CZMQAbstractNotifier * > GetActiveNotifiers() const
Definition: zmqnotificationinterface.cpp:21
MemPoolRemovalReason
MemPoolRemovalReason
Reason why a transaction was removed from the mempool, this is passed to the notification signal.
Definition: txmempool.h:400
CZMQNotificationInterface::UpdatedBlockTip
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override
Notifies listeners when the block chain tip advances.
Definition: zmqnotificationinterface.cpp:134
CTransactionRef
std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:319
CZMQNotificationInterface::notifiers
std::list< std::unique_ptr< CZMQAbstractNotifier > > notifiers
Definition: zmqnotificationinterface.h:46
CBlockIndex
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: blockindex.h:23
CZMQNotificationInterface
Definition: zmqnotificationinterface.h:16
CZMQNotificationInterface::Initialize
bool Initialize()
Definition: zmqnotificationinterface.cpp:71
CZMQNotificationInterface::~CZMQNotificationInterface
virtual ~CZMQNotificationInterface()
Definition: zmqnotificationinterface.cpp:16