@@ -687,6 +687,7 @@ void CNode::CopyStats(CNodeStats& stats)
687
687
stats.addrLocal = addrLocalUnlocked.IsValid () ? addrLocalUnlocked.ToStringAddrPort () : " " ;
688
688
689
689
X (m_conn_type);
690
+ X (m_transport_type);
690
691
}
691
692
#undef X
692
693
@@ -780,7 +781,7 @@ bool CNode::ReceiveMsgBytes(Span<const uint8_t> msg_bytes, bool& complete)
780
781
// to talk v1 or v2. if the first message is not VERSION, we reinterpret the
781
782
// bytes as v2 ellswift
782
783
if (gArgs .GetBoolArg (" -v2transport" , DEFAULT_V2_TRANSPORT) &&
783
- !m_prefer_p2p_v2 && IsInboundConn () &&
784
+ m_transport_type == TransportProtocolType::V1 && IsInboundConn () &&
784
785
mapRecvBytesPerMsgType.at (NetMsgType::VERSION) == 0 &&
785
786
msg.m_type != NetMsgType::VERSION) {
786
787
return false ;
@@ -1352,6 +1353,7 @@ void CConnman::CreateNodeFromAcceptedSocket(std::unique_ptr<Sock>&& sock,
1352
1353
.permission_flags = permission_flags,
1353
1354
.prefer_evict = discouraged,
1354
1355
.prefer_p2p_v2 = false });
1356
+ pnode->m_transport_type = TransportProtocolType::V1;
1355
1357
pnode->AddRef ();
1356
1358
m_msgproc->InitializeNode (*pnode, nodeServices);
1357
1359
@@ -1664,6 +1666,7 @@ void CConnman::SocketHandlerConnected(const std::vector<CNode*>& nodes,
1664
1666
PushV2EllSwiftPubkey (pnode);
1665
1667
// We now know the peer prefers a BIP324 v2 connection
1666
1668
pnode->m_prefer_p2p_v2 = true ;
1669
+ pnode->m_transport_type = TransportProtocolType::V2;
1667
1670
}
1668
1671
1669
1672
// Keys are not derived because we don't have the peer ellswift yet, keep buffering.
@@ -1750,6 +1753,7 @@ void CConnman::SocketHandlerConnected(const std::vector<CNode*>& nodes,
1750
1753
pnode->CloseSocketDisconnect ();
1751
1754
} else {
1752
1755
pnode->m_bip324_shared_state ->key_exchange_complete = true ;
1756
+ pnode->m_transport_type = TransportProtocolType::V2;
1753
1757
if (!pnode->IsInboundConn ()) {
1754
1758
// Outbound peer has completed key exchange and can start the P2P protocol
1755
1759
m_msgproc->InitP2P (*pnode, nLocalServices);
@@ -2480,6 +2484,9 @@ void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai
2480
2484
// Only the outbound peer knows that both sides support BIP324 transport
2481
2485
if (pnode->PreferV2Conn ()) {
2482
2486
PushV2EllSwiftPubkey (pnode);
2487
+ pnode->m_transport_type = TransportProtocolType::V2;
2488
+ } else {
2489
+ pnode->m_transport_type = TransportProtocolType::V1;
2483
2490
}
2484
2491
m_msgproc->InitializeNode (*pnode, nLocalServices);
2485
2492
{
@@ -3242,6 +3249,7 @@ CNode::CNode(NodeId idIn,
3242
3249
m_inbound_onion{inbound_onion},
3243
3250
m_prefer_evict{node_opts.prefer_evict },
3244
3251
nKeyedNetGroup{nKeyedNetGroupIn},
3252
+ m_transport_type{node_opts.transport_type },
3245
3253
id{idIn},
3246
3254
nLocalHostNonce{nLocalHostNonceIn},
3247
3255
m_conn_type{conn_type_in},
0 commit comments