21 for (std::list<CZMQAbstractNotifier *>::iterator i =
notifiers.begin();
27 std::list<const CZMQAbstractNotifier *>
29 std::list<const CZMQAbstractNotifier *> result;
38 std::map<std::string, CZMQNotifierFactory> factories;
39 std::list<CZMQAbstractNotifier *>
notifiers;
41 factories[
"pubhashblock"] =
42 CZMQAbstractNotifier::Create<CZMQPublishHashBlockNotifier>;
43 factories[
"pubhashtx"] =
44 CZMQAbstractNotifier::Create<CZMQPublishHashTransactionNotifier>;
45 factories[
"pubrawblock"] =
46 CZMQAbstractNotifier::Create<CZMQPublishRawBlockNotifier>;
47 factories[
"pubrawtx"] =
48 CZMQAbstractNotifier::Create<CZMQPublishRawTransactionNotifier>;
50 for (
const auto &entry : factories) {
51 std::string arg(
"-zmq" + entry.first);
61 notifiers.push_back(notifier);
65 if (!notifiers.empty()) {
70 delete notificationInterface;
71 notificationInterface =
nullptr;
75 return notificationInterface;
80 int major = 0, minor = 0, patch = 0;
81 zmq_version(&major, &minor, &patch);
90 zmqError(
"Unable to initialize context");
94 std::list<CZMQAbstractNotifier *>::iterator i =
notifiers.begin();
118 for (std::list<CZMQAbstractNotifier *>::iterator i =
notifiers.begin();
133 bool fInitialDownload) {
135 if (fInitialDownload || pindexNew == pindexFork) {
139 for (std::list<CZMQAbstractNotifier *>::iterator i =
notifiers.begin();
157 for (std::list<CZMQAbstractNotifier *>::iterator i =
notifiers.begin();
170 const std::shared_ptr<const CBlock> &pblock,
179 const std::shared_ptr<const CBlock> &pblock,
std::shared_ptr< const CTransaction > CTransactionRef
void BlockDisconnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexDisconnected) override
Notifies listeners of a block being disconnected.
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
std::list< CZMQAbstractNotifier * > notifiers
#define LogPrint(category,...)
void TransactionAddedToMempool(const CTransactionRef &tx) override
Notifies listeners of a transaction having been added to mempool.
virtual bool NotifyBlock(const CBlockIndex *pindex)
std::string GetAddress() const
static CZMQNotificationInterface * Create()
virtual bool NotifyTransaction(const CTransaction &transaction)
virtual ~CZMQNotificationInterface()
void SetOutboundMessageHighWaterMark(const int sndhwm)
void BlockConnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexConnected) override
Notifies listeners of a block being connected.
void SetAddress(const std::string &a)
static const int DEFAULT_ZMQ_SNDHWM
virtual void Shutdown()=0
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override
Notifies listeners when the block chain tip advances.
void zmqError(const char *str)
The block chain is a tree shaped structure starting with the genesis block at the root...
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
CZMQAbstractNotifier *(* CZMQNotifierFactory)()
virtual bool Initialize(void *pcontext)=0
std::list< const CZMQAbstractNotifier * > GetActiveNotifiers() const
The basic transaction that is broadcasted on the network and contained in blocks. ...
CZMQNotificationInterface()
void SetType(const std::string &t)
std::string GetType() const
CZMQNotificationInterface * g_zmq_notification_interface