@@ -687,6 +687,7 @@ void CNode::CopyStats(CNodeStats& stats)
687
687
stats.addrLocal = addrLocalUnlocked.IsValid () ? addrLocalUnlocked.ToString () : " " ;
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 ;
@@ -1346,6 +1347,7 @@ void CConnman::CreateNodeFromAcceptedSocket(std::unique_ptr<Sock>&& sock,
1346
1347
.permission_flags = permission_flags,
1347
1348
.prefer_evict = discouraged,
1348
1349
.prefer_p2p_v2 = false });
1350
+ pnode->m_transport_type = TransportProtocolType::V1;
1349
1351
pnode->AddRef ();
1350
1352
m_msgproc->InitializeNode (*pnode, nodeServices);
1351
1353
@@ -1658,6 +1660,7 @@ void CConnman::SocketHandlerConnected(const std::vector<CNode*>& nodes,
1658
1660
PushV2EllSwiftPubkey (pnode);
1659
1661
// We now know the peer prefers a BIP324 v2 connection
1660
1662
pnode->m_prefer_p2p_v2 = true ;
1663
+ pnode->m_transport_type = TransportProtocolType::V2;
1661
1664
}
1662
1665
1663
1666
// Keys are not derived because we don't have the peer ellswift yet, keep buffering.
@@ -1744,6 +1747,7 @@ void CConnman::SocketHandlerConnected(const std::vector<CNode*>& nodes,
1744
1747
pnode->CloseSocketDisconnect ();
1745
1748
} else {
1746
1749
pnode->m_bip324_shared_state ->key_exchange_complete = true ;
1750
+ pnode->m_transport_type = TransportProtocolType::V2;
1747
1751
if (!pnode->IsInboundConn ()) {
1748
1752
// Outbound peer has completed key exchange and can start the P2P protocol
1749
1753
m_msgproc->InitP2P (*pnode, nLocalServices);
@@ -2472,6 +2476,9 @@ void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai
2472
2476
// Only the outbound peer knows that both sides support BIP324 transport
2473
2477
if (pnode->PreferV2Conn ()) {
2474
2478
PushV2EllSwiftPubkey (pnode);
2479
+ pnode->m_transport_type = TransportProtocolType::V2;
2480
+ } else {
2481
+ pnode->m_transport_type = TransportProtocolType::V1;
2475
2482
}
2476
2483
m_msgproc->InitializeNode (*pnode, nLocalServices);
2477
2484
{
@@ -3234,6 +3241,7 @@ CNode::CNode(NodeId idIn,
3234
3241
m_inbound_onion{inbound_onion},
3235
3242
m_prefer_evict{node_opts.prefer_evict },
3236
3243
nKeyedNetGroup{nKeyedNetGroupIn},
3244
+ m_transport_type{node_opts.transport_type },
3237
3245
id{idIn},
3238
3246
nLocalHostNonce{nLocalHostNonceIn},
3239
3247
m_conn_type{conn_type_in},
0 commit comments