1 // Copyright (c) 2015-2018 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 <validationinterface.h> 9 #include <string> 10 #include <map> 11 #include <list> 12 13 class CBlockIndex; 14 class CZMQAbstractNotifier; 15 16 class CZMQNotificationInterface final : public CValidationInterface 17 { 18 public: 19 virtual ~CZMQNotificationInterface(); 20 21 std::list<const CZMQAbstractNotifier*> GetActiveNotifiers() const; 22 23 static CZMQNotificationInterface* Create(); 24 25 protected: 26 bool Initialize(); 27 void Shutdown(); 28 29 // CValidationInterface 30 void TransactionAddedToMempool(const CTransactionRef& tx) override; 31 void BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexConnected, const std::vector<CTransactionRef>& vtxConflicted) override; 32 void BlockDisconnected(const std::shared_ptr<const CBlock>& pblock) override; 33 void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override; 34 35 private: 36 CZMQNotificationInterface(); 37 38 void *pcontext; 39 std::list<CZMQAbstractNotifier*> notifiers; 40 }; 41 42 extern CZMQNotificationInterface* g_zmq_notification_interface; 43 44 #endif // BITCOIN_ZMQ_ZMQNOTIFICATIONINTERFACE_H 45