Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2015-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#ifndef BITCOIN_ZMQ_ZMQABSTRACTNOTIFIER_H6#define BITCOIN_ZMQ_ZMQABSTRACTNOTIFIER_H8#include <cstdint>9#include <functional>10#include <memory>11#include <string>13class CBlockIndex;14class CTransaction;15class CZMQAbstractNotifier;17using CZMQNotifierFactory = std::function<std::unique_ptr<CZMQAbstractNotifier>()>;19class CZMQAbstractNotifier20{21public:22static constexpr int DEFAULT_ZMQ_SNDHWM {1000};24virtual ~CZMQAbstractNotifier();26template <typename T>27static std::unique_ptr<CZMQAbstractNotifier> Create()28{29return std::make_unique<T>();30}32std::string GetType() const { return type; }33void SetType(const std::string &t) { type = t; }34std::string GetAddress() const { return address; }35void SetAddress(const std::string &a) { address = a; }36int GetOutboundMessageHighWaterMark() const { return outbound_message_high_water_mark; }37void SetOutboundMessageHighWaterMark(const int sndhwm) {38if (sndhwm >= 0) {39outbound_message_high_water_mark = sndhwm;40}41}43virtual bool Initialize(void *pcontext) = 0;44virtual void Shutdown() = 0;46// Notifies of ConnectTip result, i.e., new active tip only47virtual bool NotifyBlock(const CBlockIndex *pindex);48// Notifies of every block connection49virtual bool NotifyBlockConnect(const CBlockIndex *pindex);50// Notifies of every block disconnection51virtual bool NotifyBlockDisconnect(const CBlockIndex *pindex);52// Notifies of every mempool acceptance53virtual bool NotifyTransactionAcceptance(const CTransaction &transaction, uint64_t mempool_sequence);54// Notifies of every mempool removal, except inclusion in blocks55virtual bool NotifyTransactionRemoval(const CTransaction &transaction, uint64_t mempool_sequence);56// Notifies of transactions added to mempool or appearing in blocks57virtual bool NotifyTransaction(const CTransaction &transaction);59protected:60void* psocket{nullptr};61std::string type;62std::string address;63int outbound_message_high_water_mark{DEFAULT_ZMQ_SNDHWM}; // aka SNDHWM64};66#endif // BITCOIN_ZMQ_ZMQABSTRACTNOTIFIER_H
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.