From f08adec886febbfe038cedc32970c27c6f72bd5f Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 3 Oct 2023 10:18:51 +0100 Subject: [PATCH 1/2] qt: Add "Transport" label to peer details --- src/qt/forms/debugwindow.ui | 130 +++++++++++++++++++++--------------- src/qt/rpcconsole.cpp | 15 ++++- 2 files changed, 91 insertions(+), 54 deletions(-) diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui index f1b66341d1..5cdba64378 100644 --- a/src/qt/forms/debugwindow.ui +++ b/src/qt/forms/debugwindow.ui @@ -1085,17 +1085,17 @@ - + - The network protocol this peer is connected through: IPv4, IPv6, Onion, I2P, or CJDNS. + The transport layer version: %1 - Network + Transport - + IBeamCursor @@ -1111,14 +1111,17 @@ - + + + The network protocol this peer is connected through: IPv4, IPv6, Onion, I2P, or CJDNS. + - Version + Network - + IBeamCursor @@ -1134,14 +1137,14 @@ - + - User Agent + Version - + IBeamCursor @@ -1157,13 +1160,36 @@ + + + User Agent + + + + + + + IBeamCursor + + + N/A + + + Qt::PlainText + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + Services - + IBeamCursor @@ -1182,7 +1208,7 @@ - + Whether we relay transactions to this peer. @@ -1192,7 +1218,7 @@ - + IBeamCursor @@ -1208,7 +1234,7 @@ - + High bandwidth BIP152 compact block relay: %1 @@ -1218,7 +1244,7 @@ - + IBeamCursor @@ -1234,14 +1260,14 @@ - + Starting Block - + IBeamCursor @@ -1257,14 +1283,14 @@ - + Synced Headers - + IBeamCursor @@ -1280,14 +1306,14 @@ - + Synced Blocks - + IBeamCursor @@ -1303,14 +1329,14 @@ - + Connection Time - + IBeamCursor @@ -1326,7 +1352,7 @@ - + Elapsed time since a novel block passing initial validity checks was received from this peer. @@ -1336,7 +1362,7 @@ - + IBeamCursor @@ -1352,7 +1378,7 @@ - + Elapsed time since a novel transaction accepted into our mempool was received from this peer. @@ -1362,7 +1388,7 @@ - + IBeamCursor @@ -1378,14 +1404,14 @@ - + Last Send - + IBeamCursor @@ -1401,14 +1427,14 @@ - + Last Receive - + IBeamCursor @@ -1424,14 +1450,14 @@ - + Sent - + IBeamCursor @@ -1447,14 +1473,14 @@ - + Received - + IBeamCursor @@ -1470,14 +1496,14 @@ - + Ping Time - + IBeamCursor @@ -1493,7 +1519,7 @@ - + The duration of a currently outstanding ping. @@ -1503,7 +1529,7 @@ - + IBeamCursor @@ -1519,14 +1545,14 @@ - + Min Ping - + IBeamCursor @@ -1542,14 +1568,14 @@ - + Time Offset - + IBeamCursor @@ -1565,7 +1591,7 @@ - + The mapped Autonomous System used for diversifying peer selection. @@ -1575,7 +1601,7 @@ - + IBeamCursor @@ -1591,7 +1617,7 @@ - + Whether we relay addresses to this peer. @@ -1601,7 +1627,7 @@ - + IBeamCursor @@ -1617,7 +1643,7 @@ - + The total number of addresses received from this peer that were processed (excludes addresses that were dropped due to rate-limiting). @@ -1627,7 +1653,7 @@ - + IBeamCursor @@ -1643,7 +1669,7 @@ - + The total number of addresses received from this peer that were dropped (not processed) due to rate-limiting. @@ -1653,7 +1679,7 @@ - + IBeamCursor @@ -1669,7 +1695,7 @@ - + Qt::Vertical diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index cb4ecfb6fb..27d460f8e1 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -514,8 +515,17 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty /*: 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") + "
  • \"" @@ -1191,6 +1201,7 @@ void RPCConsole::updateDetailWidget() 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))); ui->peerNetwork->setText(GUIUtil::NetworkToQString(stats->nodeStats.m_network)); if (stats->nodeStats.m_permission_flags == NetPermissionFlags::None) { ui->peerPermissions->setText(ts.na); From d9c4e344d70bbf31ccb7162d83d4bd25762bc678 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 3 Oct 2023 10:19:09 +0100 Subject: [PATCH 2/2] qt: Add "Session id" label to peer details --- src/qt/forms/debugwindow.ui | 130 +++++++++++++++++++++--------------- src/qt/rpcconsole.cpp | 8 +++ 2 files changed, 86 insertions(+), 52 deletions(-) diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui index 5cdba64378..60e9bcde33 100644 --- a/src/qt/forms/debugwindow.ui +++ b/src/qt/forms/debugwindow.ui @@ -1111,17 +1111,17 @@ - + - The network protocol this peer is connected through: IPv4, IPv6, Onion, I2P, or CJDNS. + The BIP324 session ID string in hex, if any. - Network + Session ID - + IBeamCursor @@ -1137,14 +1137,17 @@ - + + + The network protocol this peer is connected through: IPv4, IPv6, Onion, I2P, or CJDNS. + - Version + Network - + IBeamCursor @@ -1160,14 +1163,14 @@ - + - User Agent + Version - + IBeamCursor @@ -1183,13 +1186,36 @@ + + + User Agent + + + + + + + IBeamCursor + + + N/A + + + Qt::PlainText + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + Services - + IBeamCursor @@ -1208,7 +1234,7 @@ - + Whether we relay transactions to this peer. @@ -1218,7 +1244,7 @@ - + IBeamCursor @@ -1234,7 +1260,7 @@ - + High bandwidth BIP152 compact block relay: %1 @@ -1244,7 +1270,7 @@ - + IBeamCursor @@ -1260,14 +1286,14 @@ - + Starting Block - + IBeamCursor @@ -1283,14 +1309,14 @@ - + Synced Headers - + IBeamCursor @@ -1306,14 +1332,14 @@ - + Synced Blocks - + IBeamCursor @@ -1329,14 +1355,14 @@ - + Connection Time - + IBeamCursor @@ -1352,7 +1378,7 @@ - + Elapsed time since a novel block passing initial validity checks was received from this peer. @@ -1362,7 +1388,7 @@ - + IBeamCursor @@ -1378,7 +1404,7 @@ - + Elapsed time since a novel transaction accepted into our mempool was received from this peer. @@ -1388,7 +1414,7 @@ - + IBeamCursor @@ -1404,14 +1430,14 @@ - + Last Send - + IBeamCursor @@ -1427,14 +1453,14 @@ - + Last Receive - + IBeamCursor @@ -1450,14 +1476,14 @@ - + Sent - + IBeamCursor @@ -1473,14 +1499,14 @@ - + Received - + IBeamCursor @@ -1496,14 +1522,14 @@ - + Ping Time - + IBeamCursor @@ -1519,7 +1545,7 @@ - + The duration of a currently outstanding ping. @@ -1529,7 +1555,7 @@ - + IBeamCursor @@ -1545,14 +1571,14 @@ - + Min Ping - + IBeamCursor @@ -1568,14 +1594,14 @@ - + Time Offset - + IBeamCursor @@ -1591,7 +1617,7 @@ - + The mapped Autonomous System used for diversifying peer selection. @@ -1601,7 +1627,7 @@ - + IBeamCursor @@ -1617,7 +1643,7 @@ - + Whether we relay addresses to this peer. @@ -1627,7 +1653,7 @@ - + IBeamCursor @@ -1643,7 +1669,7 @@ - + The total number of addresses received from this peer that were processed (excludes addresses that were dropped due to rate-limiting). @@ -1653,7 +1679,7 @@ - + IBeamCursor @@ -1669,7 +1695,7 @@ - + The total number of addresses received from this peer that were dropped (not processed) due to rate-limiting. @@ -1679,7 +1705,7 @@ - + IBeamCursor @@ -1695,7 +1721,7 @@ - + Qt::Vertical diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 27d460f8e1..998a4e5cbe 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -1202,6 +1202,14 @@ void RPCConsole::updateDetailWidget() } 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);