Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13115739
D8728.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D8728.diff
View Options
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -934,10 +934,6 @@
}
}
-static bool IsOutboundDisconnectionCandidate(const CNode &node) {
- return node.IsOutboundOrBlockRelayConn();
-}
-
void PeerLogicValidation::InitializeNode(const Config &config, CNode *pnode) {
CAddress addr = pnode->addr;
std::string addrName = pnode->GetAddrName();
@@ -2137,7 +2133,7 @@
// until we have a headers chain that has at least
// nMinimumChainWork, even if a peer has a chain past our tip,
// as an anti-DoS measure.
- if (IsOutboundDisconnectionCandidate(pfrom)) {
+ if (pfrom.IsOutboundOrBlockRelayConn()) {
LogPrintf("Disconnecting outbound peer %d -- headers "
"chain has insufficient work\n",
pfrom.GetId());
@@ -2146,7 +2142,7 @@
}
}
- if (!pfrom.fDisconnect && IsOutboundDisconnectionCandidate(pfrom) &&
+ if (!pfrom.fDisconnect && pfrom.IsOutboundOrBlockRelayConn() &&
nodestate->pindexBestKnownBlock != nullptr &&
pfrom.m_tx_relay != nullptr) {
// If this is an outbound full-relay peer, check to see if we should
@@ -4357,8 +4353,8 @@
CNodeState &state = *State(pto.GetId());
const CNetMsgMaker msgMaker(pto.GetSendVersion());
- if (!state.m_chain_sync.m_protect &&
- IsOutboundDisconnectionCandidate(pto) && state.fSyncStarted) {
+ if (!state.m_chain_sync.m_protect && pto.IsOutboundOrBlockRelayConn() &&
+ state.fSyncStarted) {
// This is an outbound peer subject to disconnection if they don't
// announce a block with as much work as the current tip within
// CHAIN_SYNC_TIMEOUT + HEADERS_RESPONSE_TIME seconds (note: if their
@@ -4453,7 +4449,7 @@
AssertLockHeld(cs_main);
// Ignore non-outbound peers, or nodes marked for disconnect already
- if (!IsOutboundDisconnectionCandidate(*pnode) || pnode->fDisconnect) {
+ if (!pnode->IsOutboundOrBlockRelayConn() || pnode->fDisconnect) {
return;
}
CNodeState *state = State(pnode->GetId());
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 1, 11:54 (55 m, 7 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5187728
Default Alt Text
D8728.diff (2 KB)
Attached To
D8728: [refactor] Remove IsOutboundDisconnectionCandidate
Event Timeline
Log In to Comment