12 #include <validation.h>
41 int rc = zmq_msg_init_size(&msg, size);
44 zmqError(
"Unable to initialize ZMQ msg");
49 void *buf = zmq_msg_data(&msg);
52 data = va_arg(args,
const void*);
54 rc = zmq_msg_send(&msg, sock, data ? ZMQ_SNDMORE : 0);
68 size = va_arg(args,
size_t);
83 psocket = zmq_socket(pcontext, ZMQ_PUB);
95 zmqError(
"Failed to set outbound message high water mark");
100 const int so_keepalive_option {1};
101 rc = zmq_setsockopt(
psocket, ZMQ_TCP_KEEPALIVE, &so_keepalive_option,
sizeof(so_keepalive_option));
103 zmqError(
"Failed to set SO_KEEPALIVE");
140 typedef std::multimap<std::string, CZMQAbstractPublishNotifier*>::iterator iterator;
143 for (iterator
it = iterpair.first;
it != iterpair.second; ++
it)
145 if (
it->second==
this)
156 zmq_setsockopt(
psocket, ZMQ_LINGER, &linger,
sizeof(linger));
168 unsigned char msgseq[
sizeof(uint32_t)];
185 for (
unsigned int i = 0; i < 32; i++)
186 data[31 - i] = hash.
begin()[i];
195 for (
unsigned int i = 0; i < 32; i++)
196 data[31 - i] = hash.
begin()[i];
211 zmqError(
"Can't read block from disk");
237 for (
unsigned int i = 0; i <
sizeof(
uint256); i++)
239 data[
sizeof(data) - 1] =
'C';
248 for (
unsigned int i = 0; i <
sizeof(
uint256); i++)
250 data[
sizeof(data) - 1] =
'D';
258 unsigned char data[
sizeof(
uint256)+
sizeof(mempool_sequence)+1];
259 for (
unsigned int i = 0; i <
sizeof(
uint256); i++)
270 unsigned char data[
sizeof(
uint256)+
sizeof(mempool_sequence)+1];
271 for (
unsigned int i = 0; i <
sizeof(
uint256); i++)
static const char * MSG_HASHBLOCK
bool NotifyTransaction(const CTransaction &transaction) override
uint32_t nSequence
upcounting per message sequence number
#define LogPrint(category,...)
const_iterator begin() const
void zmqError(const char *str)
bool NotifyBlockDisconnect(const CBlockIndex *pindex) override
bool SendZmqMessage(const char *command, const void *data, size_t size)
static void WriteLE64(unsigned char *ptr, uint64_t x)
bool ReadBlockFromDisk(CBlock &block, const FlatFilePos &pos, const Consensus::Params &consensusParams)
Functions for disk access for blocks.
std::string GetHex() const
static std::multimap< std::string, CZMQAbstractPublishNotifier * > mapPublishNotifiers
const Consensus::Params & GetConsensus() const
static void WriteLE32(unsigned char *ptr, uint32_t x)
Double ended buffer combining vector and stream-like interfaces.
static const char * MSG_HASHTX
bool NotifyTransaction(const CTransaction &transaction) override
bool NotifyBlock(const CBlockIndex *pindex) override
bool NotifyBlock(const CBlockIndex *pindex) override
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate...
static int zmq_send_multipart(void *sock, const void *data, size_t size,...)
Parameters that influence chain consensus.
bool NotifyTransactionAcceptance(const CTransaction &transaction, uint64_t mempool_sequence) override
static const char * MSG_RAWTX
static const char * MSG_RAWBLOCK
The block chain is a tree shaped structure starting with the genesis block at the root...
const CChainParams & Params()
Return the currently selected parameters.
int RPCSerializationFlags()
void * memcpy(void *a, const void *b, size_t c)
static const int PROTOCOL_VERSION
network protocol versioning
bool NotifyTransactionRemoval(const CTransaction &transaction, uint64_t mempool_sequence) override
int outbound_message_high_water_mark
const uint256 & GetHash() const
bool NotifyBlockConnect(const CBlockIndex *pindex) override
The basic transaction that is broadcasted on the network and contained in blocks. ...
uint256 GetBlockHash() const
static const char * MSG_SEQUENCE
bool Initialize(void *pcontext) override