aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2020-10-24 03:16:04 -0400
committerSuhas Daftuar <sdaftuar@gmail.com>2020-10-27 11:14:58 -0400
commitdaf55531260833d597ee599e2d289ea1be0b1d9c (patch)
tree11c9097434ce1645353d6094419f384ae5d65c2e /src/net_processing.cpp
parentd67883d01e507dd22d1281f4a4860e79d6a46a47 (diff)
downloadbitcoin-daf55531260833d597ee599e2d289ea1be0b1d9c.tar.xz
Avoid calling CAddrMan::Connected() on block-relay-only peer addresses
Connected() updates the time we serve in addr messages, so avoid leaking block-relay-only peer connections by avoiding these calls.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 94d4052fa1..a4dfab62e2 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -837,7 +837,8 @@ void PeerManager::ReattemptInitialBroadcast(CScheduler& scheduler) const
scheduler.scheduleFromNow([&] { ReattemptInitialBroadcast(scheduler); }, delta);
}
-void PeerManager::FinalizeNode(NodeId nodeid, bool& fUpdateConnectionTime) {
+void PeerManager::FinalizeNode(const CNode& node, bool& fUpdateConnectionTime) {
+ NodeId nodeid = node.GetId();
fUpdateConnectionTime = false;
LOCK(cs_main);
int misbehavior{0};
@@ -854,7 +855,8 @@ void PeerManager::FinalizeNode(NodeId nodeid, bool& fUpdateConnectionTime) {
if (state->fSyncStarted)
nSyncStarted--;
- if (misbehavior == 0 && state->fCurrentlyConnected) {
+ if (misbehavior == 0 && state->fCurrentlyConnected && !node.IsBlockOnlyConn()) {
+ // Note: we avoid changing visible addrman state for block-relay-only peers
fUpdateConnectionTime = true;
}