14#include <validation.h>  
   44        int rc = zmq_msg_init_size(&msg, size);
 
   47            zmqError(
"Unable to initialize ZMQ msg");
 
   52        void *buf = zmq_msg_data(&msg);
 
   53        memcpy(buf, data, size);
 
   55        data = va_arg(args, 
const void*);
 
   57        rc = zmq_msg_send(&msg, sock, data ? ZMQ_SNDMORE : 0);
 
   71        size = va_arg(args, 
size_t);
 
   79    const std::string tcp_prefix = 
"tcp://";
 
   80    const size_t tcp_index = zmq_address.rfind(tcp_prefix);
 
   81    const size_t colon_index = zmq_address.rfind(
":");
 
   82    if (tcp_index == 0 && colon_index != std::string::npos) {
 
   83        const std::string 
ip = zmq_address.substr(tcp_prefix.length(), colon_index - tcp_prefix.length());
 
   86        if (addr.
IsIPv6()) 
return true;
 
  100        psocket = zmq_socket(pcontext, ZMQ_PUB);
 
  103            zmqError(
"Failed to create socket");
 
  112            zmqError(
"Failed to set outbound message high water mark");
 
  117        const int so_keepalive_option {1};
 
  118        rc = zmq_setsockopt(
psocket, ZMQ_TCP_KEEPALIVE, &so_keepalive_option, 
sizeof(so_keepalive_option));
 
  120            zmqError(
"Failed to set SO_KEEPALIVE");
 
  127        rc = zmq_setsockopt(
psocket, ZMQ_IPV6, &enable_ipv6, 
sizeof(enable_ipv6));
 
  166    typedef std::multimap<std::string, CZMQAbstractPublishNotifier*>::iterator iterator;
 
  169    for (iterator it = iterpair.first; it != iterpair.second; ++it)
 
  171        if (it->second==
this)
 
  182        zmq_setsockopt(
psocket, ZMQ_LINGER, &linger, 
sizeof(linger));
 
  194    unsigned char msgseq[
sizeof(uint32_t)];
 
  211    for (
unsigned int i = 0; i < 32; i++)
 
  212        data[31 - i] = hash.
begin()[i];
 
  221    for (
unsigned int i = 0; i < 32; i++)
 
  222        data[31 - i] = hash.
begin()[i];
 
  237            zmqError(
"Can't read block from disk");
 
  260    unsigned char data[
sizeof(hash) + 
sizeof(label) + 
sizeof(uint64_t)];
 
  261    for (
unsigned int i = 0; i < 
sizeof(hash); ++i) {
 
  262        data[
sizeof(hash) - 1 - i] = hash.
begin()[i];
 
  264    data[
sizeof(hash)] = label;
 
  265    if (sequence) 
WriteLE64(data + 
sizeof(hash) + 
sizeof(label), *sequence);
 
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
bool ReadBlockFromDisk(CBlock &block, const FlatFilePos &pos, const Consensus::Params &consensusParams)
Functions for disk access for blocks.
const CChainParams & Params()
Return the currently selected parameters.
The block chain is a tree shaped structure starting with the genesis block at the root,...
uint256 GetBlockHash() const
const Consensus::Params & GetConsensus() const
Double ended buffer combining vector and stream-like interfaces.
const_iterator begin() const
The basic transaction that is broadcasted on the network and contained in blocks.
const uint256 & GetHash() const
int outbound_message_high_water_mark
bool SendZmqMessage(const char *command, const void *data, size_t size)
uint32_t nSequence
upcounting per message sequence number
bool Initialize(void *pcontext) override
bool NotifyBlock(const CBlockIndex *pindex) override
bool NotifyTransaction(const CTransaction &transaction) override
bool NotifyBlock(const CBlockIndex *pindex) override
bool NotifyTransaction(const CTransaction &transaction) override
bool NotifyTransactionAcceptance(const CTransaction &transaction, uint64_t mempool_sequence) override
bool NotifyTransactionRemoval(const CTransaction &transaction, uint64_t mempool_sequence) override
bool NotifyBlockConnect(const CBlockIndex *pindex) override
bool NotifyBlockDisconnect(const CBlockIndex *pindex) override
std::string GetHex() const
static void WriteLE32(unsigned char *ptr, uint32_t x)
static void WriteLE64(unsigned char *ptr, uint64_t x)
static CService ip(uint32_t i)
#define LogPrint(category,...)
bool LookupHost(const std::string &name, std::vector< CNetAddr > &vIP, unsigned int nMaxSolutions, bool fAllowLookup, DNSLookupFn dns_lookup_function)
Resolve a host string to its corresponding network addresses.
int RPCSerializationFlags()
Parameters that influence chain consensus.
static const int PROTOCOL_VERSION
network protocol versioning
static const char * MSG_HASHBLOCK
static const char * MSG_SEQUENCE
static const char * MSG_RAWBLOCK
static bool SendSequenceMsg(CZMQAbstractPublishNotifier ¬ifier, uint256 hash, char label, std::optional< uint64_t > sequence={})
static bool IsZMQAddressIPV6(const std::string &zmq_address)
static std::multimap< std::string, CZMQAbstractPublishNotifier * > mapPublishNotifiers
static const char * MSG_RAWTX
static int zmq_send_multipart(void *sock, const void *data, size_t size,...)
static const char * MSG_HASHTX
void zmqError(const std::string &str)