Changeset View
Changeset View
Standalone View
Standalone View
src/zmq/zmqpublishnotifier.cpp
Show First 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | bool CZMQPublishHashBlockNotifier::NotifyBlock(const CBlockIndex *pindex) { | ||||
char data[32]; | char data[32]; | ||||
for (unsigned int i = 0; i < 32; i++) | for (unsigned int i = 0; i < 32; i++) | ||||
data[31 - i] = hash.begin()[i]; | data[31 - i] = hash.begin()[i]; | ||||
return SendMessage(MSG_HASHBLOCK, data, 32); | return SendMessage(MSG_HASHBLOCK, data, 32); | ||||
} | } | ||||
bool CZMQPublishHashTransactionNotifier::NotifyTransaction( | bool CZMQPublishHashTransactionNotifier::NotifyTransaction( | ||||
const CTransaction &transaction) { | const CTransaction &transaction) { | ||||
uint256 txid = transaction.GetId(); | uint256 txid = transaction.GetHash(); | ||||
LogPrint("zmq", "zmq: Publish hashtx %s\n", txid.GetHex()); | LogPrint("zmq", "zmq: Publish hashtx %s\n", txid.GetHex()); | ||||
char data[32]; | char data[32]; | ||||
for (unsigned int i = 0; i < 32; i++) | for (unsigned int i = 0; i < 32; i++) | ||||
data[31 - i] = txid.begin()[i]; | data[31 - i] = txid.begin()[i]; | ||||
return SendMessage(MSG_HASHTX, data, 32); | return SendMessage(MSG_HASHTX, data, 32); | ||||
} | } | ||||
bool CZMQPublishRawBlockNotifier::NotifyBlock(const CBlockIndex *pindex) { | bool CZMQPublishRawBlockNotifier::NotifyBlock(const CBlockIndex *pindex) { | ||||
Show All 13 Lines | CDataStream ss(SER_NETWORK, PROTOCOL_VERSION | RPCSerializationFlags()); | ||||
ss << block; | ss << block; | ||||
} | } | ||||
return SendMessage(MSG_RAWBLOCK, &(*ss.begin()), ss.size()); | return SendMessage(MSG_RAWBLOCK, &(*ss.begin()), ss.size()); | ||||
} | } | ||||
bool CZMQPublishRawTransactionNotifier::NotifyTransaction( | bool CZMQPublishRawTransactionNotifier::NotifyTransaction( | ||||
const CTransaction &transaction) { | const CTransaction &transaction) { | ||||
uint256 txid = transaction.GetId(); | uint256 txid = transaction.GetHash(); | ||||
LogPrint("zmq", "zmq: Publish rawtx %s\n", txid.GetHex()); | LogPrint("zmq", "zmq: Publish rawtx %s\n", txid.GetHex()); | ||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION | RPCSerializationFlags()); | CDataStream ss(SER_NETWORK, PROTOCOL_VERSION | RPCSerializationFlags()); | ||||
ss << transaction; | ss << transaction; | ||||
return SendMessage(MSG_RAWTX, &(*ss.begin()), ss.size()); | return SendMessage(MSG_RAWTX, &(*ss.begin()), ss.size()); | ||||
} | } |