21std::list<const CZMQAbstractNotifier *>
23 std::list<const CZMQAbstractNotifier *> result;
25 result.push_back(n.get());
32 std::map<std::string, CZMQNotifierFactory>
factories;
34 CZMQAbstractNotifier::Create<CZMQPublishHashBlockNotifier>;
36 CZMQAbstractNotifier::Create<CZMQPublishHashTransactionNotifier>;
39 return std::make_unique<CZMQPublishRawBlockNotifier>(
43 CZMQAbstractNotifier::Create<CZMQPublishRawTransactionNotifier>;
45 CZMQAbstractNotifier::Create<CZMQPublishSequenceNotifier>;
47 std::list<std::unique_ptr<CZMQAbstractNotifier>>
notifiers;
49 std::string
arg(
"-zmq" + entry.first);
50 const auto &
factory = entry.second;
55 notifier->SetOutboundMessageHighWaterMark(
87 zmqError(
"Unable to initialize context");
122template <
typename Function>
124 std::list<std::unique_ptr<CZMQAbstractNotifier>> ¬ifiers,
125 const Function &func) {
126 for (
auto i = notifiers.begin(); i != notifiers.end();) {
132 i = notifiers.erase(i);
156 const CTransaction &tx = *
ptx;
160 return notifier->NotifyTransaction(tx) &&
169 const CTransaction &tx = *
ptx;
178 const std::shared_ptr<const CBlock> &
pblock,
181 const CTransaction &tx = *
ptx;
184 return notifier->NotifyTransaction(tx);
196 const std::shared_ptr<const CBlock> &
pblock,
199 const CTransaction &tx = *
ptx;
202 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
Return integer argument or default value.
The block chain is a tree shaped structure starting with the genesis block at the root,...
virtual void Shutdown()=0
static const int DEFAULT_ZMQ_SNDHWM
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)
virtual ~CZMQNotificationInterface()
void BlockConnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexConnected) override
Notifies listeners of a block being connected.
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.
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
#define LogPrint(category,...)
std::shared_ptr< const CTransaction > CTransactionRef
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
MemPoolRemovalReason
Reason why a transaction was removed from the mempool, this is passed to the notification signal.
std::unique_ptr< CZMQNotificationInterface > g_zmq_notification_interface
void zmqError(const char *str)