Skip to content

Commit

Permalink
[remove] add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
stratospher committed Aug 28, 2024
1 parent 2b83c0e commit 5f45168
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
nLocalServices = ServiceFlags(nLocalServices | NODE_P2P_V2);
if (args.GetBoolArg("-v2onlyclearnet", false)) {
disable_v1conn_clearnet = true;
LogPrintf("### BLANKET V2 ONLY OPTION SET\n");
}
} else if (args.GetBoolArg("-v2onlyclearnet", false)) {
return InitError(_("Cannot set -v2onlyclearnet to true when v2transport is disabled."));
Expand Down
7 changes: 7 additions & 0 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,11 @@ void CConnman::DisconnectNodes()
.conn_type = pnode->m_conn_type,
.use_v2transport = false});
LogPrint(BCLog::NET, "retrying with v1 transport protocol for peer=%d\n", pnode->GetId());
} else {
LogPrintf("### 2. DisconnectNodes(): NOT RETRYING WITH V1 FOR %s\n", pnode->addr.ToStringAddrPort());
LogPrintf("### Network = %d\n", pnode->ConnectedThroughNetwork());
LogPrintf("### pnode->m_transport->ShouldReconnectV1() = %d\n", pnode->m_transport->ShouldReconnectV1());
LogPrintf("### !DisableV1OnClearnet(pnode->addr.GetNetClass()) = %d\n", !DisableV1OnClearnet(pnode->addr.GetNetClass()));
}

// release outbound grant (if any)
Expand Down Expand Up @@ -2743,6 +2748,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect)

bool use_v2transport(addr.nServices & GetLocalServices() & NODE_P2P_V2);
if (DisableV1OnClearnet(addr.GetNetClass()) && !use_v2transport) {
LogPrintf("### 3. ThreadOpenConnections(): %s selected from addrman for making BLOCK + FEELER + OUTBOUND is NOT V2 - WE LOOP AGAIN FOR V2\n", addr.ToStringAddrPort());
continue;
}

Expand Down Expand Up @@ -2929,6 +2935,7 @@ void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai
return;

if (DisableV1OnClearnet(addrConnect.GetNetClass()) && !use_v2transport) {
LogPrintf("### 4. OpenNetworkConnection(): %s is NOT V2 PEER\n", addrConnect.ToStringAddrPort());
return;
}

Expand Down
2 changes: 2 additions & 0 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3736,6 +3736,8 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,

const bool is_v1transport = pfrom.m_transport->GetInfo().transport_type == TransportProtocolType::V1;
if (pfrom.IsInboundConn() && is_v1transport && m_connman.DisableV1OnClearnet(pfrom.ConnectedThroughNetwork())){
LogPrintf("### 1. ProcessMessage(): INBOUND CONNECTION from %s is NOT V2 PEER\n", pfrom.addr.ToStringAddrPort());
LogPrintf("### nServices & NODE_P2P_V2 = %d\n", nServices & NODE_P2P_V2);
pfrom.fDisconnect = true;
return;
}
Expand Down

0 comments on commit 5f45168

Please sign in to comment.