Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
zmq
zmqnotificationinterface.h
Go to the documentation of this file.
1
// Copyright (c) 2015-present 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 <
primitives/transaction.h
>
9
#include <
validationinterface.h
>
10
11
#include <cstddef>
12
#include <cstdint>
13
#include <functional>
14
#include <list>
15
#include <memory>
16
#include <vector>
17
18
class
CBlockIndex
;
19
class
CZMQAbstractNotifier
;
20
21
class
CZMQNotificationInterface
final :
public
CValidationInterface
22
{
23
public
:
24
~CZMQNotificationInterface
();
25
26
std::list<const CZMQAbstractNotifier*>
GetActiveNotifiers
()
const
;
27
28
static
std::unique_ptr<CZMQNotificationInterface>
Create
(std::function<
bool
(std::vector<std::byte>&,
const
CBlockIndex
&)> get_block_by_index);
29
30
protected
:
31
bool
Initialize
();
32
void
Shutdown
();
33
34
// CValidationInterface
35
void
TransactionAddedToMempool
(
const
NewMempoolTransactionInfo
& tx, uint64_t mempool_sequence)
override
;
36
void
TransactionRemovedFromMempool
(
const
CTransactionRef
& tx,
MemPoolRemovalReason
reason, uint64_t mempool_sequence)
override
;
37
void
BlockConnected
(
const
kernel::ChainstateRole
& role,
const
std::shared_ptr<const CBlock>& pblock,
const
CBlockIndex
* pindexConnected)
override
;
38
void
BlockDisconnected
(
const
std::shared_ptr<const CBlock>& pblock,
const
CBlockIndex
* pindexDisconnected)
override
;
39
void
UpdatedBlockTip
(
const
CBlockIndex
*pindexNew,
const
CBlockIndex
*pindexFork,
bool
fInitialDownload)
override
;
40
41
private
:
42
CZMQNotificationInterface
();
43
44
void
*
pcontext
{
nullptr
};
45
std::list<std::unique_ptr<CZMQAbstractNotifier>>
notifiers
;
46
};
47
48
extern
std::unique_ptr<CZMQNotificationInterface>
g_zmq_notification_interface
;
49
50
#endif
// BITCOIN_ZMQ_ZMQNOTIFICATIONINTERFACE_H
CBlockIndex
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition
chain.h:94
CValidationInterface
Implement this to subscribe to events generated in validation and mempool.
Definition
validationinterface.h:49
CZMQAbstractNotifier
Definition
zmqabstractnotifier.h:20
CZMQNotificationInterface::Create
static std::unique_ptr< CZMQNotificationInterface > Create(std::function< bool(std::vector< std::byte > &, const CBlockIndex &)> get_block_by_index)
Definition
zmqnotificationinterface.cpp:44
CZMQNotificationInterface::Shutdown
void Shutdown()
Definition
zmqnotificationinterface.cpp:118
CZMQNotificationInterface::Initialize
bool Initialize()
Definition
zmqnotificationinterface.cpp:88
CZMQNotificationInterface::TransactionAddedToMempool
void TransactionAddedToMempool(const NewMempoolTransactionInfo &tx, uint64_t mempool_sequence) override
Notifies listeners of a transaction having been added to mempool.
Definition
zmqnotificationinterface.cpp:161
CZMQNotificationInterface::pcontext
void * pcontext
Definition
zmqnotificationinterface.h:44
CZMQNotificationInterface::BlockConnected
void BlockConnected(const kernel::ChainstateRole &role, const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexConnected) override
Notifies listeners of a block being connected.
Definition
zmqnotificationinterface.cpp:180
CZMQNotificationInterface::~CZMQNotificationInterface
~CZMQNotificationInterface()
Definition
zmqnotificationinterface.cpp:30
CZMQNotificationInterface::UpdatedBlockTip
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override
Notifies listeners when the block chain tip advances.
Definition
zmqnotificationinterface.cpp:151
CZMQNotificationInterface::notifiers
std::list< std::unique_ptr< CZMQAbstractNotifier > > notifiers
Definition
zmqnotificationinterface.h:45
CZMQNotificationInterface::BlockDisconnected
void BlockDisconnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexDisconnected) override
Notifies listeners of a block being disconnected Provides the block that was disconnected.
Definition
zmqnotificationinterface.cpp:198
CZMQNotificationInterface::CZMQNotificationInterface
CZMQNotificationInterface()
CZMQNotificationInterface::TransactionRemovedFromMempool
void TransactionRemovedFromMempool(const CTransactionRef &tx, MemPoolRemovalReason reason, uint64_t mempool_sequence) override
Notifies listeners of a transaction leaving mempool.
Definition
zmqnotificationinterface.cpp:170
CZMQNotificationInterface::GetActiveNotifiers
std::list< const CZMQAbstractNotifier * > GetActiveNotifiers() const
Definition
zmqnotificationinterface.cpp:35
MemPoolRemovalReason
MemPoolRemovalReason
Reason why a transaction was removed from the mempool, this is passed to the notification signal.
Definition
mempool_removal_reason.h:13
transaction.h
CTransactionRef
std::shared_ptr< const CTransaction > CTransactionRef
Definition
transaction.h:403
NewMempoolTransactionInfo
Definition
mempool_entry.h:173
kernel::ChainstateRole
Information about chainstate that notifications are sent from.
Definition
types.h:18
validationinterface.h
g_zmq_notification_interface
std::unique_ptr< CZMQNotificationInterface > g_zmq_notification_interface
Definition
zmqnotificationinterface.cpp:213
Generated on
for Bitcoin Core by
1.17.0