@@ -827,11 +827,6 @@ void UpdateLastBlockAnnounceTime(NodeId node, int64_t time_in_seconds)
827
827
if (state) state->m_last_block_announcement = time_in_seconds;
828
828
}
829
829
830
- static bool IsOutboundDisconnectionCandidate (const CNode& node)
831
- {
832
- return node.IsOutboundOrBlockRelayConn ();
833
- }
834
-
835
830
void PeerLogicValidation::InitializeNode (CNode *pnode) {
836
831
CAddress addr = pnode->addr ;
837
832
std::string addrName = pnode->GetAddrName ();
@@ -1963,14 +1958,14 @@ static void ProcessHeadersMessage(CNode& pfrom, CConnman& connman, ChainstateMan
1963
1958
// until we have a headers chain that has at least
1964
1959
// nMinimumChainWork, even if a peer has a chain past our tip,
1965
1960
// as an anti-DoS measure.
1966
- if (IsOutboundDisconnectionCandidate ( pfrom)) {
1961
+ if (pfrom. IsOutboundOrBlockRelayConn ( )) {
1967
1962
LogPrintf (" Disconnecting outbound peer %d -- headers chain has insufficient work\n " , pfrom.GetId ());
1968
1963
pfrom.fDisconnect = true ;
1969
1964
}
1970
1965
}
1971
1966
}
1972
1967
1973
- if (!pfrom.fDisconnect && IsOutboundDisconnectionCandidate ( pfrom) && nodestate->pindexBestKnownBlock != nullptr && pfrom.m_tx_relay != nullptr ) {
1968
+ if (!pfrom.fDisconnect && pfrom. IsOutboundOrBlockRelayConn ( ) && nodestate->pindexBestKnownBlock != nullptr && pfrom.m_tx_relay != nullptr ) {
1974
1969
// If this is an outbound full-relay peer, check to see if we should protect
1975
1970
// it from the bad/lagging chain logic.
1976
1971
// Note that block-relay-only peers are already implicitly protected, so we
@@ -3854,7 +3849,7 @@ void PeerLogicValidation::ConsiderEviction(CNode& pto, int64_t time_in_seconds)
3854
3849
CNodeState &state = *State (pto.GetId ());
3855
3850
const CNetMsgMaker msgMaker (pto.GetSendVersion ());
3856
3851
3857
- if (!state.m_chain_sync .m_protect && IsOutboundDisconnectionCandidate ( pto) && state.fSyncStarted ) {
3852
+ if (!state.m_chain_sync .m_protect && pto. IsOutboundOrBlockRelayConn ( ) && state.fSyncStarted ) {
3858
3853
// This is an outbound peer subject to disconnection if they don't
3859
3854
// announce a block with as much work as the current tip within
3860
3855
// CHAIN_SYNC_TIMEOUT + HEADERS_RESPONSE_TIME seconds (note: if
@@ -3916,7 +3911,7 @@ void PeerLogicValidation::EvictExtraOutboundPeers(int64_t time_in_seconds)
3916
3911
AssertLockHeld (cs_main);
3917
3912
3918
3913
// Ignore non-outbound peers, or nodes marked for disconnect already
3919
- if (!IsOutboundDisconnectionCandidate (* pnode) || pnode->fDisconnect ) return ;
3914
+ if (!pnode-> IsOutboundOrBlockRelayConn ( ) || pnode->fDisconnect ) return ;
3920
3915
CNodeState *state = State (pnode->GetId ());
3921
3916
if (state == nullptr ) return ; // shouldn't be possible, but just in case
3922
3917
// Don't evict our protected peers
0 commit comments