Bitcoin ABC  0.26.3
P2P Digital Currency
zmqpublishnotifier.h
Go to the documentation of this file.
1 // Copyright (c) 2015-2016 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_ZMQPUBLISHNOTIFIER_H
6 #define BITCOIN_ZMQ_ZMQPUBLISHNOTIFIER_H
7 
9 
10 #include <functional>
11 
12 class CBlock;
13 class CBlockIndex;
14 
16 private:
18  uint32_t nSequence{0U};
19 
20 public:
21  /* send zmq multipart message
22  parts:
23  * command
24  * data
25  * message sequence number
26  */
27  bool SendZmqMessage(const char *command, const void *data, size_t size);
28 
29  bool Initialize(void *pcontext) override;
30  void Shutdown() override;
31 };
32 
34 public:
35  bool NotifyBlock(const CBlockIndex *pindex) override;
36 };
37 
39 public:
40  bool NotifyTransaction(const CTransaction &transaction) override;
41 };
42 
44 private:
45  const std::function<bool(CBlock &, const CBlockIndex &)>
47 
48 public:
50  std::function<bool(CBlock &, const CBlockIndex &)> get_block_by_index)
51  : m_get_block_by_index{std::move(get_block_by_index)} {}
52  bool NotifyBlock(const CBlockIndex *pindex) override;
53 };
54 
56 public:
57  bool NotifyTransaction(const CTransaction &transaction) override;
58 };
59 
61 public:
62  bool NotifyBlockConnect(const CBlockIndex *pindex) override;
63  bool NotifyBlockDisconnect(const CBlockIndex *pindex) override;
64  bool NotifyTransactionAcceptance(const CTransaction &transaction,
65  uint64_t mempool_sequence) override;
66  bool NotifyTransactionRemoval(const CTransaction &transaction,
67  uint64_t mempool_sequence) override;
68 };
69 
70 #endif // BITCOIN_ZMQ_ZMQPUBLISHNOTIFIER_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
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:192
bool SendZmqMessage(const char *command, const void *data, size_t size)
uint32_t nSequence
upcounting per message sequence number
bool Initialize(void *pcontext) override
bool NotifyBlock(const CBlockIndex *pindex) override
bool NotifyTransaction(const CTransaction &transaction) override
bool NotifyBlock(const CBlockIndex *pindex) override
const std::function< bool(CBlock &, const CBlockIndex &)> m_get_block_by_index
CZMQPublishRawBlockNotifier(std::function< bool(CBlock &, const CBlockIndex &)> get_block_by_index)
bool NotifyTransaction(const CTransaction &transaction) override
bool NotifyTransactionAcceptance(const CTransaction &transaction, uint64_t mempool_sequence) override
bool NotifyTransactionRemoval(const CTransaction &transaction, uint64_t mempool_sequence) override
bool NotifyBlockConnect(const CBlockIndex *pindex) override
bool NotifyBlockDisconnect(const CBlockIndex *pindex) override
Implement std::hash so RCUPtr can be used as a key for maps or sets.
Definition: rcu.h:257