From deaee147b7ef4a28a304ee16b92e3ca0712226bc Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Tue, 15 Oct 2024 11:19:07 +0000 Subject: [PATCH] merge bitcoin-core/gui#754: Add BIP324-specific labels to peer details --- src/qt/forms/debugwindow.ui | 168 +++++++++++++++++++++++------------- src/qt/rpcconsole.cpp | 23 ++++- 2 files changed, 131 insertions(+), 60 deletions(-) diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui index d6ea9fd3eb..c45f6bcaeb 100644 --- a/src/qt/forms/debugwindow.ui +++ b/src/qt/forms/debugwindow.ui @@ -977,17 +977,17 @@ - + - The network protocol this peer is connected through: IPv4, IPv6, Onion, I2P, or CJDNS. + The transport layer version: %1 - Network + Transport - + IBeamCursor @@ -1003,14 +1003,17 @@ - + + + The BIP324 session ID string in hex, if any. + - Permissions + Session ID - + IBeamCursor @@ -1026,17 +1029,17 @@ - + - The direction and type of peer connection: %1 + The network protocol this peer is connected through: IPv4, IPv6, Onion, I2P, or CJDNS. - Direction/Type + Network - + IBeamCursor @@ -1052,14 +1055,14 @@ - + - Version + Permissions - + IBeamCursor @@ -1075,13 +1078,62 @@ + + + The direction and type of peer connection: %1 + + + Direction/Type + + + + + + + IBeamCursor + + + N/A + + + Qt::PlainText + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + Version + + + + + + + IBeamCursor + + + N/A + + + Qt::PlainText + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + User Agent - + IBeamCursor @@ -1100,14 +1152,14 @@ - + Services - + IBeamCursor @@ -1123,7 +1175,7 @@ - + Whether the peer requested us to relay transactions. @@ -1133,7 +1185,7 @@ - + IBeamCursor @@ -1149,7 +1201,7 @@ - + High bandwidth BIP152 compact block relay: %1 @@ -1159,7 +1211,7 @@ - + IBeamCursor @@ -1175,14 +1227,14 @@ - + Starting Block - + IBeamCursor @@ -1198,14 +1250,14 @@ - + Synced Headers - + IBeamCursor @@ -1221,14 +1273,14 @@ - + Synced Blocks - + IBeamCursor @@ -1244,14 +1296,14 @@ - + Connection Time - + IBeamCursor @@ -1267,7 +1319,7 @@ - + Elapsed time since a novel block passing initial validity checks was received from this peer. @@ -1277,7 +1329,7 @@ - + IBeamCursor @@ -1293,7 +1345,7 @@ - + Elapsed time since a novel transaction accepted into our mempool was received from this peer. @@ -1303,7 +1355,7 @@ - + IBeamCursor @@ -1319,14 +1371,14 @@ - + Last Send - + IBeamCursor @@ -1342,14 +1394,14 @@ - + Last Receive - + IBeamCursor @@ -1365,14 +1417,14 @@ - + Sent - + IBeamCursor @@ -1388,14 +1440,14 @@ - + Received - + IBeamCursor @@ -1411,14 +1463,14 @@ - + Ping Time - + IBeamCursor @@ -1434,7 +1486,7 @@ - + The duration of a currently outstanding ping. @@ -1444,7 +1496,7 @@ - + IBeamCursor @@ -1460,14 +1512,14 @@ - + Min Ping - + IBeamCursor @@ -1483,14 +1535,14 @@ - + Time Offset - + IBeamCursor @@ -1506,7 +1558,7 @@ - + The mapped Autonomous System used for diversifying peer selection. @@ -1516,7 +1568,7 @@ - + IBeamCursor @@ -1532,7 +1584,7 @@ - + Whether we relay addresses to this peer. @@ -1542,7 +1594,7 @@ - + IBeamCursor @@ -1558,7 +1610,7 @@ - + Total number of addresses processed, excluding those dropped due to rate-limiting. @@ -1568,7 +1620,7 @@ - + IBeamCursor @@ -1584,7 +1636,7 @@ - + Total number of addresses dropped due to rate-limiting. @@ -1594,7 +1646,7 @@ - + IBeamCursor @@ -1610,7 +1662,7 @@ - + Qt::Vertical diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index b76b05bced..e5c6c20466 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -533,8 +534,17 @@ RPCConsole::RPCConsole(interfaces::Node& node, QWidget* parent, Qt::WindowFlags /*: Explanatory text for a short-lived outbound peer connection that is used to request addresses from a peer. */ tr("Outbound Address Fetch: short-lived, for soliciting addresses")}; - const QString list{"
  • " + Join(CONNECTION_TYPE_DOC, QString("
  • ")) + "
"}; - ui->peerConnectionTypeLabel->setToolTip(ui->peerConnectionTypeLabel->toolTip().arg(list)); + const QString connection_types_list{"
  • " + Join(CONNECTION_TYPE_DOC, QString("
  • ")) + "
"}; + ui->peerConnectionTypeLabel->setToolTip(ui->peerConnectionTypeLabel->toolTip().arg(connection_types_list)); + const std::vector TRANSPORT_TYPE_DOC{ + //: Explanatory text for "detecting" transport type. + tr("detecting: peer could be v1 or v2"), + //: Explanatory text for v1 transport type. + tr("v1: unencrypted, plaintext transport protocol"), + //: Explanatory text for v2 transport type. + tr("v2: BIP324 encrypted transport protocol")}; + const QString transport_types_list{"
  • " + Join(TRANSPORT_TYPE_DOC, QString("
  • ")) + "
"}; + ui->peerTransportTypeLabel->setToolTip(ui->peerTransportTypeLabel->toolTip().arg(transport_types_list)); const QString hb_list{"
  • \"" + ts.to + "\" – " + tr("we selected the peer for high bandwidth relay") + "
  • \"" + ts.from + "\" – " + tr("the peer selected us for high bandwidth relay") + "
  • \"" @@ -1272,6 +1282,15 @@ void RPCConsole::updateDetailWidget() ui->peerVersion->setText(QString::number(stats->nodeStats.nVersion)); ui->peerSubversion->setText(QString::fromStdString(stats->nodeStats.cleanSubVer)); ui->peerConnectionType->setText(GUIUtil::ConnectionTypeToQString(stats->nodeStats.m_conn_type, /* prepend_direction */ true)); + ui->peerTransportType->setText(QString::fromStdString(TransportTypeAsString(stats->nodeStats.m_transport_type))); + if (stats->nodeStats.m_transport_type == TransportProtocolType::V2) { + ui->peerSessionIdLabel->setVisible(true); + ui->peerSessionId->setVisible(true); + ui->peerSessionId->setText(QString::fromStdString(stats->nodeStats.m_session_id)); + } else { + ui->peerSessionIdLabel->setVisible(false); + ui->peerSessionId->setVisible(false); + } ui->peerNetwork->setText(GUIUtil::NetworkToQString(stats->nodeStats.m_network)); if (stats->nodeStats.m_permission_flags == NetPermissionFlags::None) { ui->peerPermissions->setText(ts.na);