Bitcoin ABC 0.31.1
P2P Digital Currency
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
9
10#include <functional>
11#include <list>
12#include <memory>
13
14class CBlockIndex;
16
18public:
20
21 std::list<const CZMQAbstractNotifier *> GetActiveNotifiers() const;
22
23 static std::unique_ptr<CZMQNotificationInterface> Create(
24 std::function<bool(CBlock &, const CBlockIndex &)> get_block_by_index);
25
26protected:
27 bool Initialize();
28 void Shutdown();
29
30 // CValidationInterface
32 std::shared_ptr<const std::vector<Coin>>,
33 uint64_t mempool_sequence) override;
36 uint64_t mempool_sequence) override;
38 const std::shared_ptr<const CBlock> &pblock,
39 const CBlockIndex *pindexConnected) override;
40 void BlockDisconnected(const std::shared_ptr<const CBlock> &pblock,
41 const CBlockIndex *pindexDisconnected) override;
42 void UpdatedBlockTip(const CBlockIndex *pindexNew,
43 const CBlockIndex *pindexFork,
44 bool fInitialDownload) override;
45
46private:
48
49 void *pcontext;
50 std::list<std::unique_ptr<CZMQAbstractNotifier>> notifiers;
51};
52
53extern std::unique_ptr<CZMQNotificationInterface> g_zmq_notification_interface;
54
55#endif // BITCOIN_ZMQ_ZMQNOTIFICATIONINTERFACE_H
Definition: block.h:60
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: blockindex.h:25
Implement this to subscribe to events generated in validation.
void TransactionAddedToMempool(const CTransactionRef &tx, std::shared_ptr< const std::vector< Coin > >, uint64_t mempool_sequence) override
Notifies listeners of a transaction having been added to mempool.
static std::unique_ptr< CZMQNotificationInterface > Create(std::function< bool(CBlock &, const CBlockIndex &)> get_block_by_index)
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override
Notifies listeners when the block chain tip advances.
std::list< std::unique_ptr< CZMQAbstractNotifier > > notifiers
void BlockDisconnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexDisconnected) override
Notifies listeners of a block being disconnected.
void BlockConnected(ChainstateRole role, const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexConnected) override
Notifies listeners of a block being connected.
void TransactionRemovedFromMempool(const CTransactionRef &tx, MemPoolRemovalReason reason, uint64_t mempool_sequence) override
Notifies listeners of a transaction leaving mempool.
std::list< const CZMQAbstractNotifier * > GetActiveNotifiers() const
ChainstateRole
This enum describes the various roles a specific Chainstate instance can take.
Definition: chain.h:14
std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:315
MemPoolRemovalReason
Reason why a transaction was removed from the mempool, this is passed to the notification signal.
Definition: txmempool.h:153
std::unique_ptr< CZMQNotificationInterface > g_zmq_notification_interface