 |
Bitcoin Core
21.99.0
P2P Digital Currency
|
Go to the documentation of this file.
13 #include <validation.h>
43 int rc = zmq_msg_init_size(&msg, size);
46 zmqError(
"Unable to initialize ZMQ msg");
51 void *buf = zmq_msg_data(&msg);
52 memcpy(buf, data, size);
54 data = va_arg(args,
const void*);
56 rc = zmq_msg_send(&msg, sock, data ? ZMQ_SNDMORE : 0);
70 size = va_arg(args,
size_t);
85 psocket = zmq_socket(pcontext, ZMQ_PUB);
97 zmqError(
"Failed to set outbound message high water mark");
102 const int so_keepalive_option {1};
103 rc = zmq_setsockopt(
psocket, ZMQ_TCP_KEEPALIVE, &so_keepalive_option,
sizeof(so_keepalive_option));
105 zmqError(
"Failed to set SO_KEEPALIVE");
142 typedef std::multimap<std::string, CZMQAbstractPublishNotifier*>::iterator iterator;
145 for (iterator
it = iterpair.first;
it != iterpair.second; ++
it)
147 if (
it->second==
this)
158 zmq_setsockopt(
psocket, ZMQ_LINGER, &linger,
sizeof(linger));
170 unsigned char msgseq[
sizeof(uint32_t)];
187 for (
unsigned int i = 0; i < 32; i++)
188 data[31 - i] = hash.
begin()[i];
197 for (
unsigned int i = 0; i < 32; i++)
198 data[31 - i] = hash.
begin()[i];
213 zmqError(
"Can't read block from disk");
236 unsigned char data[
sizeof(hash) +
sizeof(label) +
sizeof(uint64_t)];
237 for (
unsigned int i = 0; i <
sizeof(hash); ++i) {
238 data[
sizeof(hash) - 1 - i] = hash.
begin()[i];
240 data[
sizeof(hash)] = label;
241 if (sequence)
WriteLE64(data +
sizeof(hash) +
sizeof(label), *sequence);
bool NotifyBlockDisconnect(const CBlockIndex *pindex) override
static const char * MSG_RAWBLOCK
bool NotifyBlockConnect(const CBlockIndex *pindex) override
const_iterator begin() const
static void WriteLE32(unsigned char *ptr, uint32_t x)
static void WriteLE64(unsigned char *ptr, uint64_t x)
const Consensus::Params & GetConsensus() const
void zmqError(const char *str)
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
The basic transaction that is broadcasted on the network and contained in blocks.
uint32_t nSequence
upcounting per message sequence number
bool NotifyBlock(const CBlockIndex *pindex) override
Parameters that influence chain consensus.
bool NotifyTransactionAcceptance(const CTransaction &transaction, uint64_t mempool_sequence) override
int outbound_message_high_water_mark
std::string GetHex() const
bool NotifyTransaction(const CTransaction &transaction) override
bool ReadBlockFromDisk(CBlock &block, const FlatFilePos &pos, const Consensus::Params &consensusParams)
Functions for disk access for blocks.
#define LogPrint(category,...)
uint256 GetBlockHash() const
static const char * MSG_HASHTX
bool Initialize(void *pcontext) override
bool NotifyTransaction(const CTransaction &transaction) override
int RPCSerializationFlags()
static std::multimap< std::string, CZMQAbstractPublishNotifier * > mapPublishNotifiers
const CChainParams & Params()
Return the currently selected parameters.
static const char * MSG_RAWTX
Double ended buffer combining vector and stream-like interfaces.
static bool SendSequenceMsg(CZMQAbstractPublishNotifier ¬ifier, uint256 hash, char label, std::optional< uint64_t > sequence={})
const uint256 & GetHash() const
bool SendZmqMessage(const char *command, const void *data, size_t size)
bool NotifyTransactionRemoval(const CTransaction &transaction, uint64_t mempool_sequence) override
The block chain is a tree shaped structure starting with the genesis block at the root,...
assert(std::addressof(::ChainstateActive().CoinsTip())==std::addressof(coins_cache))
bool NotifyBlock(const CBlockIndex *pindex) override
static const char * MSG_HASHBLOCK
static int zmq_send_multipart(void *sock, const void *data, size_t size,...)
static const int PROTOCOL_VERSION
network protocol versioning
static const char * MSG_SEQUENCE