@@ -686,6 +686,7 @@ void CNode::CopyStats(CNodeStats& stats)
686
686
stats.addrLocal = addrLocalUnlocked.IsValid () ? addrLocalUnlocked.ToString () : " " ;
687
687
688
688
X (m_conn_type);
689
+ X (m_transport_type);
689
690
}
690
691
#undef X
691
692
@@ -775,7 +776,7 @@ bool CNode::ReceiveMsgBytes(Span<const uint8_t> msg_bytes, bool& complete)
775
776
// to talk v1 or v2. if the first message is not VERSION, we reinterpret the
776
777
// bytes as v2 ellswift
777
778
if (gArgs .GetBoolArg (" -v2transport" , DEFAULT_V2_TRANSPORT) &&
778
- !m_prefer_p2p_v2 && IsInboundConn () &&
779
+ m_transport_type == TransportProtocolType::V1 && IsInboundConn () &&
779
780
mapRecvBytesPerMsgType.at (NetMsgType::VERSION) == 0 &&
780
781
msg.m_type != NetMsgType::VERSION) {
781
782
return false ;
@@ -1341,6 +1342,7 @@ void CConnman::CreateNodeFromAcceptedSocket(std::unique_ptr<Sock>&& sock,
1341
1342
.permission_flags = permission_flags,
1342
1343
.prefer_evict = discouraged,
1343
1344
.prefer_p2p_v2 = false });
1345
+ pnode->m_transport_type = TransportProtocolType::V1;
1344
1346
pnode->AddRef ();
1345
1347
m_msgproc->InitializeNode (*pnode, nodeServices);
1346
1348
@@ -1653,6 +1655,7 @@ void CConnman::SocketHandlerConnected(const std::vector<CNode*>& nodes,
1653
1655
PushV2EllSwiftPubkey (pnode);
1654
1656
// We now know the peer prefers a BIP324 v2 connection
1655
1657
pnode->m_prefer_p2p_v2 = true ;
1658
+ pnode->m_transport_type = TransportProtocolType::V2;
1656
1659
}
1657
1660
1658
1661
// Keys are not derived because we don't have the peer ellswift yet, keep buffering.
@@ -1739,6 +1742,7 @@ void CConnman::SocketHandlerConnected(const std::vector<CNode*>& nodes,
1739
1742
pnode->CloseSocketDisconnect ();
1740
1743
} else {
1741
1744
pnode->m_bip324_shared_state ->key_exchange_complete = true ;
1745
+ pnode->m_transport_type = TransportProtocolType::V2;
1742
1746
if (!pnode->IsInboundConn ()) {
1743
1747
// Outbound peer has completed key exchange and can start the P2P protocol
1744
1748
m_msgproc->InitP2P (*pnode, nLocalServices);
@@ -2456,6 +2460,9 @@ void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai
2456
2460
// Only the outbound peer knows that both sides support BIP324 transport
2457
2461
if (pnode->PreferV2Conn ()) {
2458
2462
PushV2EllSwiftPubkey (pnode);
2463
+ pnode->m_transport_type = TransportProtocolType::V2;
2464
+ } else {
2465
+ pnode->m_transport_type = TransportProtocolType::V1;
2459
2466
}
2460
2467
m_msgproc->InitializeNode (*pnode, nLocalServices);
2461
2468
{
@@ -3218,6 +3225,7 @@ CNode::CNode(NodeId idIn,
3218
3225
m_inbound_onion{inbound_onion},
3219
3226
m_prefer_evict{node_opts.prefer_evict },
3220
3227
nKeyedNetGroup{nKeyedNetGroupIn},
3228
+ m_transport_type{node_opts.transport_type },
3221
3229
id{idIn},
3222
3230
nLocalHostNonce{nLocalHostNonceIn},
3223
3231
m_conn_type{conn_type_in},
0 commit comments