@@ -704,6 +704,7 @@ void CNode::CopyStats(CNodeStats& stats)
704
704
stats.addrLocal = addrLocalUnlocked.IsValid () ? addrLocalUnlocked.ToStringAddrPort () : " " ;
705
705
706
706
X (m_conn_type);
707
+ X (m_transport_type);
707
708
}
708
709
#undef X
709
710
@@ -797,7 +798,7 @@ bool CNode::ReceiveMsgBytes(Span<const uint8_t> msg_bytes, bool& complete)
797
798
// to talk v1 or v2. if the first message is not VERSION, we reinterpret the
798
799
// bytes as v2 ellswift
799
800
if (gArgs .GetBoolArg (" -v2transport" , DEFAULT_V2_TRANSPORT) &&
800
- !m_prefer_p2p_v2 && IsInboundConn () &&
801
+ m_transport_type == TransportProtocolType::V1 && IsInboundConn () &&
801
802
mapRecvBytesPerMsgType.at (NetMsgType::VERSION) == 0 &&
802
803
msg.m_type != NetMsgType::VERSION) {
803
804
return false ;
@@ -1377,6 +1378,7 @@ void CConnman::CreateNodeFromAcceptedSocket(std::unique_ptr<Sock>&& sock,
1377
1378
.permission_flags = permission_flags,
1378
1379
.prefer_evict = discouraged,
1379
1380
.prefer_p2p_v2 = false });
1381
+ pnode->m_transport_type = TransportProtocolType::V1;
1380
1382
pnode->AddRef ();
1381
1383
m_msgproc->InitializeNode (*pnode, nodeServices);
1382
1384
@@ -1693,6 +1695,7 @@ void CConnman::SocketHandlerConnected(const std::vector<CNode*>& nodes,
1693
1695
PushV2EllSwiftPubkey (pnode);
1694
1696
// We now know the peer prefers a BIP324 v2 connection
1695
1697
pnode->m_prefer_p2p_v2 = true ;
1698
+ pnode->m_transport_type = TransportProtocolType::V2;
1696
1699
}
1697
1700
1698
1701
// Keys are not derived because we don't have the peer ellswift yet, keep buffering.
@@ -1779,6 +1782,7 @@ void CConnman::SocketHandlerConnected(const std::vector<CNode*>& nodes,
1779
1782
pnode->CloseSocketDisconnect ();
1780
1783
} else {
1781
1784
pnode->m_bip324_shared_state ->key_exchange_complete = true ;
1785
+ pnode->m_transport_type = TransportProtocolType::V2;
1782
1786
if (!pnode->IsInboundConn ()) {
1783
1787
// Outbound peer has completed key exchange and can start the P2P protocol
1784
1788
m_msgproc->InitP2P (*pnode, nLocalServices);
@@ -2515,6 +2519,9 @@ void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai
2515
2519
// Only the outbound peer knows that both sides support BIP324 transport
2516
2520
if (pnode->PreferV2Conn ()) {
2517
2521
PushV2EllSwiftPubkey (pnode);
2522
+ pnode->m_transport_type = TransportProtocolType::V2;
2523
+ } else {
2524
+ pnode->m_transport_type = TransportProtocolType::V1;
2518
2525
}
2519
2526
m_msgproc->InitializeNode (*pnode, nLocalServices);
2520
2527
{
@@ -3277,6 +3284,7 @@ CNode::CNode(NodeId idIn,
3277
3284
m_inbound_onion{inbound_onion},
3278
3285
m_prefer_evict{node_opts.prefer_evict },
3279
3286
nKeyedNetGroup{nKeyedNetGroupIn},
3287
+ m_transport_type{node_opts.transport_type },
3280
3288
id{idIn},
3281
3289
nLocalHostNonce{nLocalHostNonceIn},
3282
3290
m_conn_type{conn_type_in},
0 commit comments