28 static std::multimap<std::string, CZMQAbstractPublishNotifier *>
45 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);
81 std::multimap<std::string, CZMQAbstractPublishNotifier *>::iterator i =
85 psocket = zmq_socket(pcontext, ZMQ_PUB);
92 "zmq: Outbound message high water mark for %s at %s is %d\n",
95 int rc = zmq_setsockopt(
psocket, ZMQ_SNDHWM,
99 zmqError(
"Failed to set outbound message high water mark");
104 const int so_keepalive_option{1};
105 rc = zmq_setsockopt(
psocket, ZMQ_TCP_KEEPALIVE, &so_keepalive_option,
106 sizeof(so_keepalive_option));
108 zmqError(
"Failed to set SO_KEEPALIVE");
127 "zmq: Outbound message high water mark for %s at %s is %d\n",
146 typedef std::multimap<std::string, CZMQAbstractPublishNotifier *>::iterator
148 std::pair<iterator, iterator> iterpair =
151 for (iterator it = iterpair.first; it != iterpair.second; ++it) {
152 if (it->second ==
this) {
161 zmq_setsockopt(
psocket, ZMQ_LINGER, &linger,
sizeof(linger));
174 uint8_t msgseq[
sizeof(uint32_t)];
177 msgseq, (
size_t)
sizeof(uint32_t),
nullptr);
193 for (
unsigned int i = 0; i < 32; i++) {
194 data[31 - i] = hash.
begin()[i];
205 for (
unsigned int i = 0; i < 32; i++) {
206 data[31 - i] = txid.
begin()[i];
220 zmqError(
"Can't read block from disk");
244 hash.
GetHex(), this->address);
246 for (
unsigned int i = 0; i <
sizeof(
BlockHash); i++) {
250 data[
sizeof(data) - 1] =
'C';
258 hash.
GetHex(), this->address);
260 for (
unsigned int i = 0; i <
sizeof(
BlockHash); i++) {
264 data[
sizeof(data) - 1] =
'D';
269 const CTransaction &transaction, uint64_t mempool_sequence) {
272 txid.
GetHex(), this->address);
273 uint8_t data[
sizeof(
TxId) +
sizeof(mempool_sequence) + 1];
274 for (
unsigned int i = 0; i <
sizeof(
TxId); i++) {
275 data[
sizeof(
TxId) - 1 - i] = txid.
begin()[i];
278 data[
sizeof(
TxId)] =
'A';
284 const CTransaction &transaction, uint64_t mempool_sequence) {
287 txid.
GetHex(), this->address);
288 uint8_t data[
sizeof(
TxId) +
sizeof(mempool_sequence) + 1];
289 for (
unsigned int i = 0; i <
sizeof(
TxId); i++) {
290 data[
sizeof(
TxId) - 1 - i] = txid.
begin()[i];
293 data[
sizeof(
TxId)] =
'R';
The block chain is a tree shaped structure starting with the genesis block at the root,...
BlockHash 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.
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
virtual const CChainParams & GetChainParams() const =0
std::string GetHex() const
const Config & GetConfig()
static void WriteLE32(uint8_t *ptr, uint32_t x)
static void WriteLE64(uint8_t *ptr, uint64_t x)
#define LogPrint(category,...)
bool ReadBlockFromDisk(CBlock &block, const FlatFilePos &pos, const Consensus::Params ¶ms)
Functions for disk access for blocks.
int RPCSerializationFlags()
Retrieves any serialization flags requested in command line argument.
A BlockHash is a unqiue identifier for a block.
A TxId is the identifier of a transaction.
static const int PROTOCOL_VERSION
network protocol versioning
static const char * MSG_HASHBLOCK
static const char * MSG_SEQUENCE
static std::multimap< std::string, CZMQAbstractPublishNotifier * > mapPublishNotifiers
static const char * MSG_RAWBLOCK
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 char *str)