37 std::list<const CZMQAbstractNotifier*> result;
39 result.push_back(n.get());
46 std::map<std::string, CZMQNotifierFactory>
factories;
47 factories[
"pubhashblock"] = CZMQAbstractNotifier::Create<CZMQPublishHashBlockNotifier>;
48 factories[
"pubhashtx"] = CZMQAbstractNotifier::Create<CZMQPublishHashTransactionNotifier>;
52 factories[
"pubrawtx"] = CZMQAbstractNotifier::Create<CZMQPublishRawTransactionNotifier>;
53 factories[
"pubsequence"] = CZMQAbstractNotifier::Create<CZMQPublishSequenceNotifier>;
55 std::list<std::unique_ptr<CZMQAbstractNotifier>>
notifiers;
58 std::string
arg(
"-zmq" + entry.first);
59 const auto&
factory = entry.second;
101 zmqError(
"Unable to initialize context");
135template <
typename Function>
138 for (
auto i = notifiers.begin(); i != notifiers.end(); ) {
144 i = notifiers.erase(i);
188 return notifier->NotifyTransaction(tx);
203 return notifier->NotifyTransaction(tx);
std::vector< std::string > GetArgs(const std::string &strArg) const
Return a vector of strings of the given argument.
int64_t GetIntArg(const std::string &strArg, int64_t nDefault) const
The block chain is a tree shaped structure starting with the genesis block at the root,...
The basic transaction that is broadcasted on the network and contained in blocks.
virtual void Shutdown()=0
static const int DEFAULT_ZMQ_SNDHWM
static std::unique_ptr< CZMQNotificationInterface > Create(std::function< bool(std::vector< std::byte > &, const CBlockIndex &)> get_block_by_index)
void TransactionAddedToMempool(const NewMempoolTransactionInfo &tx, uint64_t mempool_sequence) override
Notifies listeners of a transaction having been added to mempool.
void BlockConnected(const kernel::ChainstateRole &role, const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexConnected) override
Notifies listeners of a block being connected.
~CZMQNotificationInterface()
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 Provides the block that was disconnected.
CZMQNotificationInterface()
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
is a home for simple enum and struct type definitions that can be used internally by functions in the...
#define LogDebug(category,...)
MemPoolRemovalReason
Reason why a transaction was removed from the mempool, this is passed to the notification signal.
const std::string ADDR_PREFIX_UNIX
Prefix for unix domain socket addresses (which are local filesystem paths)
std::shared_ptr< const CTransaction > CTransactionRef
Information about chainstate that notifications are sent from.
bool historical
Whether this is a historical chainstate downloading old blocks to validate an assumeutxo snapshot,...
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
std::unique_ptr< CZMQNotificationInterface > g_zmq_notification_interface
void zmqError(const std::string &str)
const std::string ADDR_PREFIX_IPC
Prefix for unix domain socket addresses (which are local filesystem paths)