mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-17 00:42:45 +00:00
log: show placeholders for missing peer fields
Avoid logging an empty field when peer user agent or collision entry is missing. Co-authored-by: naiyoma <lankas.aurelia@gmail.com>
This commit is contained in:
parent
b65ff0e5a1
commit
9cf82bed32
@ -663,8 +663,8 @@ bool AddrManImpl::Good_(const CService& addr, bool test_before_evict, NodeSecond
|
||||
}
|
||||
// Output the entry we'd be colliding with, for debugging purposes
|
||||
auto colliding_entry = mapInfo.find(vvTried[tried_bucket][tried_bucket_pos]);
|
||||
LogDebug(BCLog::ADDRMAN, "Collision with %s while attempting to move %s to tried table. Collisions=%d\n",
|
||||
colliding_entry != mapInfo.end() ? colliding_entry->second.ToStringAddrPort() : "",
|
||||
LogDebug(BCLog::ADDRMAN, "Collision with %s while attempting to move %s to tried table. Collisions=%d",
|
||||
colliding_entry != mapInfo.end() ? colliding_entry->second.ToStringAddrPort() : "<unknown-addr>",
|
||||
addr.ToStringAddrPort(),
|
||||
m_tried_collisions.size());
|
||||
return false;
|
||||
|
||||
@ -3669,8 +3669,8 @@ void PeerManagerImpl::ProcessMessage(Peer& peer, CNode& pfrom, const std::string
|
||||
}
|
||||
|
||||
const auto mapped_as{m_connman.GetMappedAS(pfrom.addr)};
|
||||
LogDebug(BCLog::NET, "receive version message: %s: version %d, blocks=%d, us=%s, txrelay=%d, peer=%d%s%s\n",
|
||||
cleanSubVer, pfrom.nVersion,
|
||||
LogDebug(BCLog::NET, "receive version message: %s: version %d, blocks=%d, us=%s, txrelay=%d, peer=%d%s%s",
|
||||
cleanSubVer.empty() ? "<no user agent>" : cleanSubVer, pfrom.nVersion,
|
||||
peer.m_starting_height, addrMe.ToStringAddrPort(), fRelay, pfrom.GetId(),
|
||||
pfrom.LogIP(fLogIPs), (mapped_as ? strprintf(", mapped_as=%d", mapped_as) : ""));
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user