9 #include "validation.h" 15 LogPrint(
"zmq",
"zmq: Error: %s, errno=%s\n", str, zmq_strerror(errno));
26 for (std::list<CZMQAbstractNotifier*>::iterator i=
notifiers.begin(); i!=
notifiers.end(); ++i)
35 std::map<std::string, CZMQNotifierFactory> factories;
36 std::list<CZMQAbstractNotifier*>
notifiers;
38 factories[
"pubhashblock"] = CZMQAbstractNotifier::Create<CZMQPublishHashBlockNotifier>;
39 factories[
"pubhashtx"] = CZMQAbstractNotifier::Create<CZMQPublishHashTransactionNotifier>;
40 factories[
"pubhashtxlock"] = CZMQAbstractNotifier::Create<CZMQPublishHashTransactionLockNotifier>;
41 factories[
"pubrawblock"] = CZMQAbstractNotifier::Create<CZMQPublishRawBlockNotifier>;
42 factories[
"pubrawtx"] = CZMQAbstractNotifier::Create<CZMQPublishRawTransactionNotifier>;
43 factories[
"pubrawtxlock"] = CZMQAbstractNotifier::Create<CZMQPublishRawTransactionLockNotifier>;
45 for (std::map<std::string, CZMQNotifierFactory>::const_iterator i=factories.begin(); i!=factories.end(); ++i)
47 std::map<std::string, std::string>::const_iterator j = args.find(
"-zmq" + i->first);
51 std::string address = j->second;
66 delete notificationInterface;
67 notificationInterface = NULL;
71 return notificationInterface;
77 LogPrint(
"zmq",
"zmq: Initialize notification interface\n");
84 zmqError(
"Unable to initialize context");
88 std::list<CZMQAbstractNotifier*>::iterator i=
notifiers.begin();
114 LogPrint(
"zmq",
"zmq: Shutdown notification interface\n");
117 for (std::list<CZMQAbstractNotifier*>::iterator i=
notifiers.begin(); i!=
notifiers.end(); ++i)
131 if (fInitialDownload || pindexNew == pindexFork)
134 for (std::list<CZMQAbstractNotifier*>::iterator i =
notifiers.begin(); i!=
notifiers.end(); )
151 for (std::list<CZMQAbstractNotifier*>::iterator i =
notifiers.begin(); i!=
notifiers.end(); )
168 for (std::list<CZMQAbstractNotifier*>::iterator i =
notifiers.begin(); i!=
notifiers.end(); )
virtual bool NotifyTransaction(const CTransaction &transaction)
void NotifyTransactionLock(const CTransaction &tx)
void SetAddress(const std::string &a)
void SyncTransaction(const CTransaction &tx, const CBlock *pblock)
virtual bool Initialize(void *pcontext)=0
std::string GetType() const
virtual bool NotifyBlock(const CBlockIndex *pindex)
static CZMQNotificationInterface * CreateWithArguments(const std::map< std::string, std::string > &args)
static int LogPrint(const char *category, const char *format)
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload)
virtual bool NotifyTransactionLock(const CTransaction &transaction)
virtual void Shutdown()=0
void zmqError(const char *str)
CZMQNotificationInterface()
CZMQAbstractNotifier *(* CZMQNotifierFactory)()
void SetType(const std::string &t)
virtual ~CZMQNotificationInterface()
std::string GetAddress() const
std::list< CZMQAbstractNotifier * > notifiers