2018-01-02 14:12:05 -03:00
|
|
|
// Copyright (c) 2015-2017 The Bitcoin Core developers
|
2014-11-18 14:06:32 -03:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#ifndef BITCOIN_ZMQ_ZMQNOTIFICATIONINTERFACE_H
|
|
|
|
#define BITCOIN_ZMQ_ZMQNOTIFICATIONINTERFACE_H
|
|
|
|
|
2017-11-09 21:57:53 -03:00
|
|
|
#include <validationinterface.h>
|
2014-11-18 14:06:32 -03:00
|
|
|
#include <string>
|
|
|
|
#include <map>
|
2017-01-20 20:27:13 -03:00
|
|
|
#include <list>
|
2014-11-18 14:06:32 -03:00
|
|
|
|
2015-09-16 11:42:23 -03:00
|
|
|
class CBlockIndex;
|
2014-11-18 14:06:32 -03:00
|
|
|
class CZMQAbstractNotifier;
|
|
|
|
|
2017-07-12 16:48:36 -04:00
|
|
|
class CZMQNotificationInterface final : public CValidationInterface
|
2014-11-18 14:06:32 -03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~CZMQNotificationInterface();
|
|
|
|
|
2016-11-29 23:43:29 -03:00
|
|
|
static CZMQNotificationInterface* Create();
|
2014-11-18 14:06:32 -03:00
|
|
|
|
2015-11-01 15:09:17 -03:00
|
|
|
protected:
|
2014-11-18 14:06:32 -03:00
|
|
|
bool Initialize();
|
|
|
|
void Shutdown();
|
|
|
|
|
2015-11-01 15:09:17 -03:00
|
|
|
// CValidationInterface
|
2017-02-08 16:00:14 -03:00
|
|
|
void TransactionAddedToMempool(const CTransactionRef& tx) override;
|
|
|
|
void BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexConnected, const std::vector<CTransactionRef>& vtxConflicted) override;
|
|
|
|
void BlockDisconnected(const std::shared_ptr<const CBlock>& pblock) override;
|
|
|
|
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override;
|
2014-11-18 14:06:32 -03:00
|
|
|
|
|
|
|
private:
|
|
|
|
CZMQNotificationInterface();
|
|
|
|
|
|
|
|
void *pcontext;
|
|
|
|
std::list<CZMQAbstractNotifier*> notifiers;
|
|
|
|
};
|
|
|
|
|
2018-06-29 09:16:31 -04:00
|
|
|
extern CZMQNotificationInterface* g_zmq_notification_interface;
|
|
|
|
|
2014-11-18 14:06:32 -03:00
|
|
|
#endif // BITCOIN_ZMQ_ZMQNOTIFICATIONINTERFACE_H
|