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