mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
scripted-diff: remove duplicate categories from LogPrint output
-BEGIN VERIFY SCRIPT- s() { git grep -l "$1" src | xargs sed -i "s/$1/$2/g"; } s 'BCLog::TOR, "tor: ' 'BCLog::TOR, "' s 'BCLog::I2P, "I2P: ' 'BCLog::I2P, "' s 'BCLog::NET, "net: ' 'BCLog::NET, "' s 'BCLog::ZMQ, "zmq: ' 'BCLog::ZMQ, "' s 'BCLog::PRUNE, "Prune: ' 'BCLog::PRUNE, "' -END VERIFY SCRIPT-
This commit is contained in:
parent
1b2e1d179c
commit
d40550d725
7 changed files with 41 additions and 41 deletions
|
@ -242,7 +242,7 @@ std::string Session::Reply::Get(const std::string& key) const
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
void Session::Log(const std::string& fmt, const Args&... args) const
|
void Session::Log(const std::string& fmt, const Args&... args) const
|
||||||
{
|
{
|
||||||
LogPrint(BCLog::I2P, "I2P: %s\n", tfm::format(fmt, args...));
|
LogPrint(BCLog::I2P, "%s\n", tfm::format(fmt, args...));
|
||||||
}
|
}
|
||||||
|
|
||||||
Session::Reply Session::SendRequestAndGetReply(const Sock& sock,
|
Session::Reply Session::SendRequestAndGetReply(const Sock& sock,
|
||||||
|
|
|
@ -1873,12 +1873,12 @@ bool CConnman::GetTryNewOutboundPeer() const
|
||||||
void CConnman::SetTryNewOutboundPeer(bool flag)
|
void CConnman::SetTryNewOutboundPeer(bool flag)
|
||||||
{
|
{
|
||||||
m_try_another_outbound_peer = flag;
|
m_try_another_outbound_peer = flag;
|
||||||
LogPrint(BCLog::NET, "net: setting try another outbound peer=%s\n", flag ? "true" : "false");
|
LogPrint(BCLog::NET, "setting try another outbound peer=%s\n", flag ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConnman::StartExtraBlockRelayPeers()
|
void CConnman::StartExtraBlockRelayPeers()
|
||||||
{
|
{
|
||||||
LogPrint(BCLog::NET, "net: enabling extra block-relay-only peers\n");
|
LogPrint(BCLog::NET, "enabling extra block-relay-only peers\n");
|
||||||
m_start_extra_block_relay_peers = true;
|
m_start_extra_block_relay_peers = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,7 @@ void BlockManager::FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LogPrint(BCLog::PRUNE, "Prune: target=%dMiB actual=%dMiB diff=%dMiB max_prune_height=%d removed %d blk/rev pairs\n",
|
LogPrint(BCLog::PRUNE, "target=%dMiB actual=%dMiB diff=%dMiB max_prune_height=%d removed %d blk/rev pairs\n",
|
||||||
nPruneTarget/1024/1024, nCurrentUsage/1024/1024,
|
nPruneTarget/1024/1024, nCurrentUsage/1024/1024,
|
||||||
((int64_t)nPruneTarget - (int64_t)nCurrentUsage)/1024/1024,
|
((int64_t)nPruneTarget - (int64_t)nCurrentUsage)/1024/1024,
|
||||||
nLastBlockWeCanPrune, count);
|
nLastBlockWeCanPrune, count);
|
||||||
|
|
|
@ -94,7 +94,7 @@ void TorControlConnection::readcb(struct bufferevent *bev, void *ctx)
|
||||||
self->reply_handlers.front()(*self, self->message);
|
self->reply_handlers.front()(*self, self->message);
|
||||||
self->reply_handlers.pop_front();
|
self->reply_handlers.pop_front();
|
||||||
} else {
|
} else {
|
||||||
LogPrint(BCLog::TOR, "tor: Received unexpected sync reply %i\n", self->message.code);
|
LogPrint(BCLog::TOR, "Received unexpected sync reply %i\n", self->message.code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self->message.Clear();
|
self->message.Clear();
|
||||||
|
@ -113,13 +113,13 @@ void TorControlConnection::eventcb(struct bufferevent *bev, short what, void *ct
|
||||||
{
|
{
|
||||||
TorControlConnection *self = static_cast<TorControlConnection*>(ctx);
|
TorControlConnection *self = static_cast<TorControlConnection*>(ctx);
|
||||||
if (what & BEV_EVENT_CONNECTED) {
|
if (what & BEV_EVENT_CONNECTED) {
|
||||||
LogPrint(BCLog::TOR, "tor: Successfully connected!\n");
|
LogPrint(BCLog::TOR, "Successfully connected!\n");
|
||||||
self->connected(*self);
|
self->connected(*self);
|
||||||
} else if (what & (BEV_EVENT_EOF|BEV_EVENT_ERROR)) {
|
} else if (what & (BEV_EVENT_EOF|BEV_EVENT_ERROR)) {
|
||||||
if (what & BEV_EVENT_ERROR) {
|
if (what & BEV_EVENT_ERROR) {
|
||||||
LogPrint(BCLog::TOR, "tor: Error connecting to Tor control socket\n");
|
LogPrint(BCLog::TOR, "Error connecting to Tor control socket\n");
|
||||||
} else {
|
} else {
|
||||||
LogPrint(BCLog::TOR, "tor: End of stream\n");
|
LogPrint(BCLog::TOR, "End of stream\n");
|
||||||
}
|
}
|
||||||
self->Disconnect();
|
self->Disconnect();
|
||||||
self->disconnected(*self);
|
self->disconnected(*self);
|
||||||
|
@ -318,7 +318,7 @@ TorController::TorController(struct event_base* _base, const std::string& tor_co
|
||||||
// Read service private key if cached
|
// Read service private key if cached
|
||||||
std::pair<bool,std::string> pkf = ReadBinaryFile(GetPrivateKeyFile());
|
std::pair<bool,std::string> pkf = ReadBinaryFile(GetPrivateKeyFile());
|
||||||
if (pkf.first) {
|
if (pkf.first) {
|
||||||
LogPrint(BCLog::TOR, "tor: Reading cached private key from %s\n", fs::PathToString(GetPrivateKeyFile()));
|
LogPrint(BCLog::TOR, "Reading cached private key from %s\n", fs::PathToString(GetPrivateKeyFile()));
|
||||||
private_key = pkf.second;
|
private_key = pkf.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -359,7 +359,7 @@ void TorController::get_socks_cb(TorControlConnection& _conn, const TorControlRe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!socks_location.empty()) {
|
if (!socks_location.empty()) {
|
||||||
LogPrint(BCLog::TOR, "tor: Get SOCKS port command yielded %s\n", socks_location);
|
LogPrint(BCLog::TOR, "Get SOCKS port command yielded %s\n", socks_location);
|
||||||
} else {
|
} else {
|
||||||
LogPrintf("tor: Get SOCKS port command returned nothing\n");
|
LogPrintf("tor: Get SOCKS port command returned nothing\n");
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,7 @@ void TorController::get_socks_cb(TorControlConnection& _conn, const TorControlRe
|
||||||
}
|
}
|
||||||
|
|
||||||
Assume(resolved.IsValid());
|
Assume(resolved.IsValid());
|
||||||
LogPrint(BCLog::TOR, "tor: Configuring onion proxy for %s\n", resolved.ToStringIPPort());
|
LogPrint(BCLog::TOR, "Configuring onion proxy for %s\n", resolved.ToStringIPPort());
|
||||||
Proxy addrOnion = Proxy(resolved, true);
|
Proxy addrOnion = Proxy(resolved, true);
|
||||||
SetProxy(NET_ONION, addrOnion);
|
SetProxy(NET_ONION, addrOnion);
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ void TorController::get_socks_cb(TorControlConnection& _conn, const TorControlRe
|
||||||
void TorController::add_onion_cb(TorControlConnection& _conn, const TorControlReply& reply)
|
void TorController::add_onion_cb(TorControlConnection& _conn, const TorControlReply& reply)
|
||||||
{
|
{
|
||||||
if (reply.code == 250) {
|
if (reply.code == 250) {
|
||||||
LogPrint(BCLog::TOR, "tor: ADD_ONION successful\n");
|
LogPrint(BCLog::TOR, "ADD_ONION successful\n");
|
||||||
for (const std::string &s : reply.lines) {
|
for (const std::string &s : reply.lines) {
|
||||||
std::map<std::string,std::string> m = ParseTorReplyMapping(s);
|
std::map<std::string,std::string> m = ParseTorReplyMapping(s);
|
||||||
std::map<std::string,std::string>::iterator i;
|
std::map<std::string,std::string>::iterator i;
|
||||||
|
@ -423,7 +423,7 @@ void TorController::add_onion_cb(TorControlConnection& _conn, const TorControlRe
|
||||||
service = LookupNumeric(std::string(service_id+".onion"), Params().GetDefaultPort());
|
service = LookupNumeric(std::string(service_id+".onion"), Params().GetDefaultPort());
|
||||||
LogPrintf("tor: Got service ID %s, advertising service %s\n", service_id, service.ToString());
|
LogPrintf("tor: Got service ID %s, advertising service %s\n", service_id, service.ToString());
|
||||||
if (WriteBinaryFile(GetPrivateKeyFile(), private_key)) {
|
if (WriteBinaryFile(GetPrivateKeyFile(), private_key)) {
|
||||||
LogPrint(BCLog::TOR, "tor: Cached service private key to %s\n", fs::PathToString(GetPrivateKeyFile()));
|
LogPrint(BCLog::TOR, "Cached service private key to %s\n", fs::PathToString(GetPrivateKeyFile()));
|
||||||
} else {
|
} else {
|
||||||
LogPrintf("tor: Error writing service private key to %s\n", fs::PathToString(GetPrivateKeyFile()));
|
LogPrintf("tor: Error writing service private key to %s\n", fs::PathToString(GetPrivateKeyFile()));
|
||||||
}
|
}
|
||||||
|
@ -439,7 +439,7 @@ void TorController::add_onion_cb(TorControlConnection& _conn, const TorControlRe
|
||||||
void TorController::auth_cb(TorControlConnection& _conn, const TorControlReply& reply)
|
void TorController::auth_cb(TorControlConnection& _conn, const TorControlReply& reply)
|
||||||
{
|
{
|
||||||
if (reply.code == 250) {
|
if (reply.code == 250) {
|
||||||
LogPrint(BCLog::TOR, "tor: Authentication successful\n");
|
LogPrint(BCLog::TOR, "Authentication successful\n");
|
||||||
|
|
||||||
// Now that we know Tor is running setup the proxy for onion addresses
|
// Now that we know Tor is running setup the proxy for onion addresses
|
||||||
// if -onion isn't set to something else.
|
// if -onion isn't set to something else.
|
||||||
|
@ -490,7 +490,7 @@ static std::vector<uint8_t> ComputeResponse(const std::string &key, const std::v
|
||||||
void TorController::authchallenge_cb(TorControlConnection& _conn, const TorControlReply& reply)
|
void TorController::authchallenge_cb(TorControlConnection& _conn, const TorControlReply& reply)
|
||||||
{
|
{
|
||||||
if (reply.code == 250) {
|
if (reply.code == 250) {
|
||||||
LogPrint(BCLog::TOR, "tor: SAFECOOKIE authentication challenge successful\n");
|
LogPrint(BCLog::TOR, "SAFECOOKIE authentication challenge successful\n");
|
||||||
std::pair<std::string,std::string> l = SplitTorReplyLine(reply.lines[0]);
|
std::pair<std::string,std::string> l = SplitTorReplyLine(reply.lines[0]);
|
||||||
if (l.first == "AUTHCHALLENGE") {
|
if (l.first == "AUTHCHALLENGE") {
|
||||||
std::map<std::string,std::string> m = ParseTorReplyMapping(l.second);
|
std::map<std::string,std::string> m = ParseTorReplyMapping(l.second);
|
||||||
|
@ -500,7 +500,7 @@ void TorController::authchallenge_cb(TorControlConnection& _conn, const TorContr
|
||||||
}
|
}
|
||||||
std::vector<uint8_t> serverHash = ParseHex(m["SERVERHASH"]);
|
std::vector<uint8_t> serverHash = ParseHex(m["SERVERHASH"]);
|
||||||
std::vector<uint8_t> serverNonce = ParseHex(m["SERVERNONCE"]);
|
std::vector<uint8_t> serverNonce = ParseHex(m["SERVERNONCE"]);
|
||||||
LogPrint(BCLog::TOR, "tor: AUTHCHALLENGE ServerHash %s ServerNonce %s\n", HexStr(serverHash), HexStr(serverNonce));
|
LogPrint(BCLog::TOR, "AUTHCHALLENGE ServerHash %s ServerNonce %s\n", HexStr(serverHash), HexStr(serverNonce));
|
||||||
if (serverNonce.size() != 32) {
|
if (serverNonce.size() != 32) {
|
||||||
LogPrintf("tor: ServerNonce is not 32 bytes, as required by spec\n");
|
LogPrintf("tor: ServerNonce is not 32 bytes, as required by spec\n");
|
||||||
return;
|
return;
|
||||||
|
@ -547,12 +547,12 @@ void TorController::protocolinfo_cb(TorControlConnection& _conn, const TorContro
|
||||||
std::map<std::string,std::string> m = ParseTorReplyMapping(l.second);
|
std::map<std::string,std::string> m = ParseTorReplyMapping(l.second);
|
||||||
std::map<std::string,std::string>::iterator i;
|
std::map<std::string,std::string>::iterator i;
|
||||||
if ((i = m.find("Tor")) != m.end()) {
|
if ((i = m.find("Tor")) != m.end()) {
|
||||||
LogPrint(BCLog::TOR, "tor: Connected to Tor version %s\n", i->second);
|
LogPrint(BCLog::TOR, "Connected to Tor version %s\n", i->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const std::string &s : methods) {
|
for (const std::string &s : methods) {
|
||||||
LogPrint(BCLog::TOR, "tor: Supported authentication method: %s\n", s);
|
LogPrint(BCLog::TOR, "Supported authentication method: %s\n", s);
|
||||||
}
|
}
|
||||||
// Prefer NULL, otherwise SAFECOOKIE. If a password is provided, use HASHEDPASSWORD
|
// Prefer NULL, otherwise SAFECOOKIE. If a password is provided, use HASHEDPASSWORD
|
||||||
/* Authentication:
|
/* Authentication:
|
||||||
|
@ -562,18 +562,18 @@ void TorController::protocolinfo_cb(TorControlConnection& _conn, const TorContro
|
||||||
std::string torpassword = gArgs.GetArg("-torpassword", "");
|
std::string torpassword = gArgs.GetArg("-torpassword", "");
|
||||||
if (!torpassword.empty()) {
|
if (!torpassword.empty()) {
|
||||||
if (methods.count("HASHEDPASSWORD")) {
|
if (methods.count("HASHEDPASSWORD")) {
|
||||||
LogPrint(BCLog::TOR, "tor: Using HASHEDPASSWORD authentication\n");
|
LogPrint(BCLog::TOR, "Using HASHEDPASSWORD authentication\n");
|
||||||
ReplaceAll(torpassword, "\"", "\\\"");
|
ReplaceAll(torpassword, "\"", "\\\"");
|
||||||
_conn.Command("AUTHENTICATE \"" + torpassword + "\"", std::bind(&TorController::auth_cb, this, std::placeholders::_1, std::placeholders::_2));
|
_conn.Command("AUTHENTICATE \"" + torpassword + "\"", std::bind(&TorController::auth_cb, this, std::placeholders::_1, std::placeholders::_2));
|
||||||
} else {
|
} else {
|
||||||
LogPrintf("tor: Password provided with -torpassword, but HASHEDPASSWORD authentication is not available\n");
|
LogPrintf("tor: Password provided with -torpassword, but HASHEDPASSWORD authentication is not available\n");
|
||||||
}
|
}
|
||||||
} else if (methods.count("NULL")) {
|
} else if (methods.count("NULL")) {
|
||||||
LogPrint(BCLog::TOR, "tor: Using NULL authentication\n");
|
LogPrint(BCLog::TOR, "Using NULL authentication\n");
|
||||||
_conn.Command("AUTHENTICATE", std::bind(&TorController::auth_cb, this, std::placeholders::_1, std::placeholders::_2));
|
_conn.Command("AUTHENTICATE", std::bind(&TorController::auth_cb, this, std::placeholders::_1, std::placeholders::_2));
|
||||||
} else if (methods.count("SAFECOOKIE")) {
|
} else if (methods.count("SAFECOOKIE")) {
|
||||||
// Cookie: hexdump -e '32/1 "%02x""\n"' ~/.tor/control_auth_cookie
|
// Cookie: hexdump -e '32/1 "%02x""\n"' ~/.tor/control_auth_cookie
|
||||||
LogPrint(BCLog::TOR, "tor: Using SAFECOOKIE authentication, reading cookie authentication from %s\n", cookiefile);
|
LogPrint(BCLog::TOR, "Using SAFECOOKIE authentication, reading cookie authentication from %s\n", cookiefile);
|
||||||
std::pair<bool,std::string> status_cookie = ReadBinaryFile(fs::PathFromString(cookiefile), TOR_COOKIE_SIZE);
|
std::pair<bool,std::string> status_cookie = ReadBinaryFile(fs::PathFromString(cookiefile), TOR_COOKIE_SIZE);
|
||||||
if (status_cookie.first && status_cookie.second.size() == TOR_COOKIE_SIZE) {
|
if (status_cookie.first && status_cookie.second.size() == TOR_COOKIE_SIZE) {
|
||||||
// _conn.Command("AUTHENTICATE " + HexStr(status_cookie.second), std::bind(&TorController::auth_cb, this, std::placeholders::_1, std::placeholders::_2));
|
// _conn.Command("AUTHENTICATE " + HexStr(status_cookie.second), std::bind(&TorController::auth_cb, this, std::placeholders::_1, std::placeholders::_2));
|
||||||
|
@ -615,7 +615,7 @@ void TorController::disconnected_cb(TorControlConnection& _conn)
|
||||||
if (!reconnect)
|
if (!reconnect)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LogPrint(BCLog::TOR, "tor: Not connected to Tor control port %s, trying to reconnect\n", m_tor_control_center);
|
LogPrint(BCLog::TOR, "Not connected to Tor control port %s, trying to reconnect\n", m_tor_control_center);
|
||||||
|
|
||||||
// Single-shot timer for reconnect. Use exponential backoff.
|
// Single-shot timer for reconnect. Use exponential backoff.
|
||||||
struct timeval time = MillisToTimeval(int64_t(reconnect_timeout * 1000.0));
|
struct timeval time = MillisToTimeval(int64_t(reconnect_timeout * 1000.0));
|
||||||
|
|
|
@ -70,9 +70,9 @@ bool CZMQNotificationInterface::Initialize()
|
||||||
{
|
{
|
||||||
int major = 0, minor = 0, patch = 0;
|
int major = 0, minor = 0, patch = 0;
|
||||||
zmq_version(&major, &minor, &patch);
|
zmq_version(&major, &minor, &patch);
|
||||||
LogPrint(BCLog::ZMQ, "zmq: version %d.%d.%d\n", major, minor, patch);
|
LogPrint(BCLog::ZMQ, "version %d.%d.%d\n", major, minor, patch);
|
||||||
|
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Initialize notification interface\n");
|
LogPrint(BCLog::ZMQ, "Initialize notification interface\n");
|
||||||
assert(!pcontext);
|
assert(!pcontext);
|
||||||
|
|
||||||
pcontext = zmq_ctx_new();
|
pcontext = zmq_ctx_new();
|
||||||
|
@ -85,9 +85,9 @@ bool CZMQNotificationInterface::Initialize()
|
||||||
|
|
||||||
for (auto& notifier : notifiers) {
|
for (auto& notifier : notifiers) {
|
||||||
if (notifier->Initialize(pcontext)) {
|
if (notifier->Initialize(pcontext)) {
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Notifier %s ready (address = %s)\n", notifier->GetType(), notifier->GetAddress());
|
LogPrint(BCLog::ZMQ, "Notifier %s ready (address = %s)\n", notifier->GetType(), notifier->GetAddress());
|
||||||
} else {
|
} else {
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Notifier %s failed (address = %s)\n", notifier->GetType(), notifier->GetAddress());
|
LogPrint(BCLog::ZMQ, "Notifier %s failed (address = %s)\n", notifier->GetType(), notifier->GetAddress());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,11 +98,11 @@ bool CZMQNotificationInterface::Initialize()
|
||||||
// Called during shutdown sequence
|
// Called during shutdown sequence
|
||||||
void CZMQNotificationInterface::Shutdown()
|
void CZMQNotificationInterface::Shutdown()
|
||||||
{
|
{
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Shutdown notification interface\n");
|
LogPrint(BCLog::ZMQ, "Shutdown notification interface\n");
|
||||||
if (pcontext)
|
if (pcontext)
|
||||||
{
|
{
|
||||||
for (auto& notifier : notifiers) {
|
for (auto& notifier : notifiers) {
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Shutdown notifier %s at %s\n", notifier->GetType(), notifier->GetAddress());
|
LogPrint(BCLog::ZMQ, "Shutdown notifier %s at %s\n", notifier->GetType(), notifier->GetAddress());
|
||||||
notifier->Shutdown();
|
notifier->Shutdown();
|
||||||
}
|
}
|
||||||
zmq_ctx_term(pcontext);
|
zmq_ctx_term(pcontext);
|
||||||
|
|
|
@ -106,7 +106,7 @@ bool CZMQAbstractPublishNotifier::Initialize(void *pcontext)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Outbound message high water mark for %s at %s is %d\n", type, address, outbound_message_high_water_mark);
|
LogPrint(BCLog::ZMQ, "Outbound message high water mark for %s at %s is %d\n", type, address, outbound_message_high_water_mark);
|
||||||
|
|
||||||
int rc = zmq_setsockopt(psocket, ZMQ_SNDHWM, &outbound_message_high_water_mark, sizeof(outbound_message_high_water_mark));
|
int rc = zmq_setsockopt(psocket, ZMQ_SNDHWM, &outbound_message_high_water_mark, sizeof(outbound_message_high_water_mark));
|
||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
|
@ -147,8 +147,8 @@ bool CZMQAbstractPublishNotifier::Initialize(void *pcontext)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Reusing socket for address %s\n", address);
|
LogPrint(BCLog::ZMQ, "Reusing socket for address %s\n", address);
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Outbound message high water mark for %s at %s is %d\n", type, address, outbound_message_high_water_mark);
|
LogPrint(BCLog::ZMQ, "Outbound message high water mark for %s at %s is %d\n", type, address, outbound_message_high_water_mark);
|
||||||
|
|
||||||
psocket = i->second->psocket;
|
psocket = i->second->psocket;
|
||||||
mapPublishNotifiers.insert(std::make_pair(address, this));
|
mapPublishNotifiers.insert(std::make_pair(address, this));
|
||||||
|
@ -179,7 +179,7 @@ void CZMQAbstractPublishNotifier::Shutdown()
|
||||||
|
|
||||||
if (count == 1)
|
if (count == 1)
|
||||||
{
|
{
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Close socket at address %s\n", address);
|
LogPrint(BCLog::ZMQ, "Close socket at address %s\n", address);
|
||||||
int linger = 0;
|
int linger = 0;
|
||||||
zmq_setsockopt(psocket, ZMQ_LINGER, &linger, sizeof(linger));
|
zmq_setsockopt(psocket, ZMQ_LINGER, &linger, sizeof(linger));
|
||||||
zmq_close(psocket);
|
zmq_close(psocket);
|
||||||
|
@ -208,7 +208,7 @@ bool CZMQAbstractPublishNotifier::SendZmqMessage(const char *command, const void
|
||||||
bool CZMQPublishHashBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
|
bool CZMQPublishHashBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
|
||||||
{
|
{
|
||||||
uint256 hash = pindex->GetBlockHash();
|
uint256 hash = pindex->GetBlockHash();
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Publish hashblock %s to %s\n", hash.GetHex(), this->address);
|
LogPrint(BCLog::ZMQ, "Publish hashblock %s to %s\n", hash.GetHex(), this->address);
|
||||||
uint8_t data[32];
|
uint8_t 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];
|
||||||
|
@ -219,7 +219,7 @@ bool CZMQPublishHashBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
|
||||||
bool CZMQPublishHashTransactionNotifier::NotifyTransaction(const CTransaction &transaction)
|
bool CZMQPublishHashTransactionNotifier::NotifyTransaction(const CTransaction &transaction)
|
||||||
{
|
{
|
||||||
uint256 hash = transaction.GetHash();
|
uint256 hash = transaction.GetHash();
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Publish hashtx %s to %s\n", hash.GetHex(), this->address);
|
LogPrint(BCLog::ZMQ, "Publish hashtx %s to %s\n", hash.GetHex(), this->address);
|
||||||
uint8_t data[32];
|
uint8_t 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];
|
||||||
|
@ -229,7 +229,7 @@ bool CZMQPublishHashTransactionNotifier::NotifyTransaction(const CTransaction &t
|
||||||
|
|
||||||
bool CZMQPublishRawBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
|
bool CZMQPublishRawBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
|
||||||
{
|
{
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Publish rawblock %s to %s\n", pindex->GetBlockHash().GetHex(), this->address);
|
LogPrint(BCLog::ZMQ, "Publish rawblock %s to %s\n", pindex->GetBlockHash().GetHex(), this->address);
|
||||||
|
|
||||||
const Consensus::Params& consensusParams = Params().GetConsensus();
|
const Consensus::Params& consensusParams = Params().GetConsensus();
|
||||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION | RPCSerializationFlags());
|
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION | RPCSerializationFlags());
|
||||||
|
@ -251,7 +251,7 @@ bool CZMQPublishRawBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
|
||||||
bool CZMQPublishRawTransactionNotifier::NotifyTransaction(const CTransaction &transaction)
|
bool CZMQPublishRawTransactionNotifier::NotifyTransaction(const CTransaction &transaction)
|
||||||
{
|
{
|
||||||
uint256 hash = transaction.GetHash();
|
uint256 hash = transaction.GetHash();
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Publish rawtx %s to %s\n", hash.GetHex(), this->address);
|
LogPrint(BCLog::ZMQ, "Publish rawtx %s to %s\n", hash.GetHex(), this->address);
|
||||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION | RPCSerializationFlags());
|
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION | RPCSerializationFlags());
|
||||||
ss << transaction;
|
ss << transaction;
|
||||||
return SendZmqMessage(MSG_RAWTX, &(*ss.begin()), ss.size());
|
return SendZmqMessage(MSG_RAWTX, &(*ss.begin()), ss.size());
|
||||||
|
@ -273,27 +273,27 @@ static bool SendSequenceMsg(CZMQAbstractPublishNotifier& notifier, uint256 hash,
|
||||||
bool CZMQPublishSequenceNotifier::NotifyBlockConnect(const CBlockIndex *pindex)
|
bool CZMQPublishSequenceNotifier::NotifyBlockConnect(const CBlockIndex *pindex)
|
||||||
{
|
{
|
||||||
uint256 hash = pindex->GetBlockHash();
|
uint256 hash = pindex->GetBlockHash();
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Publish sequence block connect %s to %s\n", hash.GetHex(), this->address);
|
LogPrint(BCLog::ZMQ, "Publish sequence block connect %s to %s\n", hash.GetHex(), this->address);
|
||||||
return SendSequenceMsg(*this, hash, /* Block (C)onnect */ 'C');
|
return SendSequenceMsg(*this, hash, /* Block (C)onnect */ 'C');
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CZMQPublishSequenceNotifier::NotifyBlockDisconnect(const CBlockIndex *pindex)
|
bool CZMQPublishSequenceNotifier::NotifyBlockDisconnect(const CBlockIndex *pindex)
|
||||||
{
|
{
|
||||||
uint256 hash = pindex->GetBlockHash();
|
uint256 hash = pindex->GetBlockHash();
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Publish sequence block disconnect %s to %s\n", hash.GetHex(), this->address);
|
LogPrint(BCLog::ZMQ, "Publish sequence block disconnect %s to %s\n", hash.GetHex(), this->address);
|
||||||
return SendSequenceMsg(*this, hash, /* Block (D)isconnect */ 'D');
|
return SendSequenceMsg(*this, hash, /* Block (D)isconnect */ 'D');
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CZMQPublishSequenceNotifier::NotifyTransactionAcceptance(const CTransaction &transaction, uint64_t mempool_sequence)
|
bool CZMQPublishSequenceNotifier::NotifyTransactionAcceptance(const CTransaction &transaction, uint64_t mempool_sequence)
|
||||||
{
|
{
|
||||||
uint256 hash = transaction.GetHash();
|
uint256 hash = transaction.GetHash();
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Publish hashtx mempool acceptance %s to %s\n", hash.GetHex(), this->address);
|
LogPrint(BCLog::ZMQ, "Publish hashtx mempool acceptance %s to %s\n", hash.GetHex(), this->address);
|
||||||
return SendSequenceMsg(*this, hash, /* Mempool (A)cceptance */ 'A', mempool_sequence);
|
return SendSequenceMsg(*this, hash, /* Mempool (A)cceptance */ 'A', mempool_sequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CZMQPublishSequenceNotifier::NotifyTransactionRemoval(const CTransaction &transaction, uint64_t mempool_sequence)
|
bool CZMQPublishSequenceNotifier::NotifyTransactionRemoval(const CTransaction &transaction, uint64_t mempool_sequence)
|
||||||
{
|
{
|
||||||
uint256 hash = transaction.GetHash();
|
uint256 hash = transaction.GetHash();
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Publish hashtx mempool removal %s to %s\n", hash.GetHex(), this->address);
|
LogPrint(BCLog::ZMQ, "Publish hashtx mempool removal %s to %s\n", hash.GetHex(), this->address);
|
||||||
return SendSequenceMsg(*this, hash, /* Mempool (R)emoval */ 'R', mempool_sequence);
|
return SendSequenceMsg(*this, hash, /* Mempool (R)emoval */ 'R', mempool_sequence);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,5 @@
|
||||||
|
|
||||||
void zmqError(const std::string& str)
|
void zmqError(const std::string& str)
|
||||||
{
|
{
|
||||||
LogPrint(BCLog::ZMQ, "zmq: Error: %s, msg: %s\n", str, zmq_strerror(errno));
|
LogPrint(BCLog::ZMQ, "Error: %s, msg: %s\n", str, zmq_strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue