merge bitcoin-core/gui#754: Add BIP324-specific labels to peer details

This commit is contained in:
Kittywhiskers Van Gogh 2024-10-15 11:19:07 +00:00
parent fffe6e716b
commit deaee147b7
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
2 changed files with 131 additions and 60 deletions

View File

@ -977,17 +977,17 @@
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="peerNetworkLabel">
<widget class="QLabel" name="peerTransportTypeLabel">
<property name="toolTip">
<string>The network protocol this peer is connected through: IPv4, IPv6, Onion, I2P, or CJDNS.</string>
<string>The transport layer version: %1</string>
</property>
<property name="text">
<string>Network</string>
<string>Transport</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="peerNetwork">
<widget class="QLabel" name="peerTransportType">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
@ -1003,14 +1003,17 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_30">
<widget class="QLabel" name="peerSessionIdLabel">
<property name="toolTip">
<string>The BIP324 session ID string in hex, if any.</string>
</property>
<property name="text">
<string>Permissions</string>
<string>Session ID</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="peerPermissions">
<widget class="QLabel" name="peerSessionId">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
@ -1026,17 +1029,17 @@
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="peerConnectionTypeLabel">
<widget class="QLabel" name="peerNetworkLabel">
<property name="toolTip">
<string>The direction and type of peer connection: %1</string>
<string>The network protocol this peer is connected through: IPv4, IPv6, Onion, I2P, or CJDNS.</string>
</property>
<property name="text">
<string>Direction/Type</string>
<string>Network</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QLabel" name="peerConnectionType">
<widget class="QLabel" name="peerNetwork">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
@ -1052,14 +1055,14 @@
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_21">
<widget class="QLabel" name="label_30">
<property name="text">
<string>Version</string>
<string>Permissions</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QLabel" name="peerVersion">
<widget class="QLabel" name="peerPermissions">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
@ -1075,13 +1078,62 @@
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="peerConnectionTypeLabel">
<property name="toolTip">
<string>The direction and type of peer connection: %1</string>
</property>
<property name="text">
<string>Direction/Type</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QLabel" name="peerConnectionType">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Version</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QLabel" name="peerVersion">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
<string>N/A</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_28">
<property name="text">
<string>User Agent</string>
</property>
</widget>
</item>
<item row="6" column="2">
<item row="8" column="2">
<widget class="QLabel" name="peerSubversion">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1100,14 +1152,14 @@
</property>
</widget>
</item>
<item row="7" column="0">
<item row="9" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Services</string>
</property>
</widget>
</item>
<item row="7" column="2">
<item row="9" column="2">
<widget class="QLabel" name="peerServices">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1123,7 +1175,7 @@
</property>
</widget>
</item>
<item row="8" column="0">
<item row="10" column="0">
<widget class="QLabel" name="peerRelayTxesLabel">
<property name="toolTip">
<string>Whether the peer requested us to relay transactions.</string>
@ -1133,7 +1185,7 @@
</property>
</widget>
</item>
<item row="8" column="2">
<item row="10" column="2">
<widget class="QLabel" name="peerRelayTxes">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1149,7 +1201,7 @@
</property>
</widget>
</item>
<item row="9" column="0">
<item row="11" column="0">
<widget class="QLabel" name="peerHighBandwidthLabel">
<property name="toolTip">
<string>High bandwidth BIP152 compact block relay: %1</string>
@ -1159,7 +1211,7 @@
</property>
</widget>
</item>
<item row="9" column="2">
<item row="11" column="2">
<widget class="QLabel" name="peerHighBandwidth">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1175,14 +1227,14 @@
</property>
</widget>
</item>
<item row="10" column="0">
<item row="12" column="0">
<widget class="QLabel" name="label_29">
<property name="text">
<string>Starting Block</string>
</property>
</widget>
</item>
<item row="10" column="2">
<item row="12" column="2">
<widget class="QLabel" name="peerHeight">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1198,14 +1250,14 @@
</property>
</widget>
</item>
<item row="11" column="0">
<item row="13" column="0">
<widget class="QLabel" name="label_27">
<property name="text">
<string>Synced Headers</string>
</property>
</widget>
</item>
<item row="11" column="2">
<item row="13" column="2">
<widget class="QLabel" name="peerSyncHeight">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1221,14 +1273,14 @@
</property>
</widget>
</item>
<item row="12" column="0">
<item row="14" column="0">
<widget class="QLabel" name="label_25">
<property name="text">
<string>Synced Blocks</string>
</property>
</widget>
</item>
<item row="12" column="2">
<item row="14" column="2">
<widget class="QLabel" name="peerCommonHeight">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1244,14 +1296,14 @@
</property>
</widget>
</item>
<item row="13" column="0">
<item row="15" column="0">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Connection Time</string>
</property>
</widget>
</item>
<item row="13" column="2">
<item row="15" column="2">
<widget class="QLabel" name="peerConnTime">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1267,7 +1319,7 @@
</property>
</widget>
</item>
<item row="14" column="0">
<item row="16" column="0">
<widget class="QLabel" name="peerLastBlockLabel">
<property name="toolTip">
<string>Elapsed time since a novel block passing initial validity checks was received from this peer.</string>
@ -1277,7 +1329,7 @@
</property>
</widget>
</item>
<item row="14" column="2">
<item row="16" column="2">
<widget class="QLabel" name="peerLastBlock">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1293,7 +1345,7 @@
</property>
</widget>
</item>
<item row="15" column="0">
<item row="17" column="0">
<widget class="QLabel" name="peerLastTxLabel">
<property name="toolTip">
<string extracomment="Tooltip text for the Last Transaction field in the peer details area.">Elapsed time since a novel transaction accepted into our mempool was received from this peer.</string>
@ -1303,7 +1355,7 @@
</property>
</widget>
</item>
<item row="15" column="2">
<item row="17" column="2">
<widget class="QLabel" name="peerLastTx">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1319,14 +1371,14 @@
</property>
</widget>
</item>
<item row="16" column="0">
<item row="18" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Last Send</string>
</property>
</widget>
</item>
<item row="16" column="2">
<item row="18" column="2">
<widget class="QLabel" name="peerLastSend">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1342,14 +1394,14 @@
</property>
</widget>
</item>
<item row="17" column="0">
<item row="19" column="0">
<widget class="QLabel" name="label_19">
<property name="text">
<string>Last Receive</string>
</property>
</widget>
</item>
<item row="17" column="2">
<item row="19" column="2">
<widget class="QLabel" name="peerLastRecv">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1365,14 +1417,14 @@
</property>
</widget>
</item>
<item row="18" column="0">
<item row="20" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Sent</string>
</property>
</widget>
</item>
<item row="18" column="2">
<item row="20" column="2">
<widget class="QLabel" name="peerBytesSent">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1388,14 +1440,14 @@
</property>
</widget>
</item>
<item row="19" column="0">
<item row="21" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>Received</string>
</property>
</widget>
</item>
<item row="19" column="2">
<item row="21" column="2">
<widget class="QLabel" name="peerBytesRecv">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1411,14 +1463,14 @@
</property>
</widget>
</item>
<item row="20" column="0">
<item row="22" column="0">
<widget class="QLabel" name="label_26">
<property name="text">
<string>Ping Time</string>
</property>
</widget>
</item>
<item row="20" column="2">
<item row="22" column="2">
<widget class="QLabel" name="peerPingTime">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1434,7 +1486,7 @@
</property>
</widget>
</item>
<item row="21" column="0">
<item row="23" column="0">
<widget class="QLabel" name="peerPingWaitLabel">
<property name="toolTip">
<string>The duration of a currently outstanding ping.</string>
@ -1444,7 +1496,7 @@
</property>
</widget>
</item>
<item row="21" column="2">
<item row="23" column="2">
<widget class="QLabel" name="peerPingWait">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1460,14 +1512,14 @@
</property>
</widget>
</item>
<item row="22" column="0">
<item row="24" column="0">
<widget class="QLabel" name="peerMinPingLabel">
<property name="text">
<string>Min Ping</string>
</property>
</widget>
</item>
<item row="22" column="2">
<item row="24" column="2">
<widget class="QLabel" name="peerMinPing">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1483,14 +1535,14 @@
</property>
</widget>
</item>
<item row="23" column="0">
<item row="25" column="0">
<widget class="QLabel" name="label_timeoffset">
<property name="text">
<string>Time Offset</string>
</property>
</widget>
</item>
<item row="23" column="2">
<item row="25" column="2">
<widget class="QLabel" name="timeoffset">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1506,7 +1558,7 @@
</property>
</widget>
</item>
<item row="24" column="0">
<item row="26" column="0">
<widget class="QLabel" name="peerMappedASLabel">
<property name="toolTip">
<string>The mapped Autonomous System used for diversifying peer selection.</string>
@ -1516,7 +1568,7 @@
</property>
</widget>
</item>
<item row="24" column="2">
<item row="26" column="2">
<widget class="QLabel" name="peerMappedAS">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1532,7 +1584,7 @@
</property>
</widget>
</item>
<item row="25" column="0">
<item row="27" column="0">
<widget class="QLabel" name="peerAddrRelayEnabledLabel">
<property name="toolTip">
<string extracomment="Tooltip text for the Address Relay field in the peer details area.">Whether we relay addresses to this peer.</string>
@ -1542,7 +1594,7 @@
</property>
</widget>
</item>
<item row="25" column="2">
<item row="27" column="2">
<widget class="QLabel" name="peerAddrRelayEnabled">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1558,7 +1610,7 @@
</property>
</widget>
</item>
<item row="26" column="0">
<item row="28" column="0">
<widget class="QLabel" name="peerAddrProcessedLabel">
<property name="toolTip">
<string extracomment="Tooltip text for the Addresses Processed field in the peer details area.">Total number of addresses processed, excluding those dropped due to rate-limiting.</string>
@ -1568,7 +1620,7 @@
</property>
</widget>
</item>
<item row="26" column="2">
<item row="28" column="2">
<widget class="QLabel" name="peerAddrProcessed">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1584,7 +1636,7 @@
</property>
</widget>
</item>
<item row="27" column="0">
<item row="29" column="0">
<widget class="QLabel" name="peerAddrRateLimitedLabel">
<property name="toolTip">
<string extracomment="Tooltip text for the Addresses Rate-Limited field in the peer details area.">Total number of addresses dropped due to rate-limiting.</string>
@ -1594,7 +1646,7 @@
</property>
</widget>
</item>
<item row="27" column="2">
<item row="29" column="2">
<widget class="QLabel" name="peerAddrRateLimited">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@ -1610,7 +1662,7 @@
</property>
</widget>
</item>
<item row="28" column="0">
<item row="30" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>

View File

@ -15,6 +15,7 @@
#include <chainparams.h>
#include <interfaces/node.h>
#include <netbase.h>
#include <node/connection_types.h>
#include <qt/bantablemodel.h>
#include <qt/clientmodel.h>
#include <qt/peertablesortproxy.h>
@ -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{"<ul><li>" + Join(CONNECTION_TYPE_DOC, QString("</li><li>")) + "</li></ul>"};
ui->peerConnectionTypeLabel->setToolTip(ui->peerConnectionTypeLabel->toolTip().arg(list));
const QString connection_types_list{"<ul><li>" + Join(CONNECTION_TYPE_DOC, QString("</li><li>")) + "</li></ul>"};
ui->peerConnectionTypeLabel->setToolTip(ui->peerConnectionTypeLabel->toolTip().arg(connection_types_list));
const std::vector<QString> 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{"<ul><li>" + Join(TRANSPORT_TYPE_DOC, QString("</li><li>")) + "</li></ul>"};
ui->peerTransportTypeLabel->setToolTip(ui->peerTransportTypeLabel->toolTip().arg(transport_types_list));
const QString hb_list{"<ul><li>\""
+ ts.to + "\" " + tr("we selected the peer for high bandwidth relay") + "</li><li>\""
+ ts.from + "\" " + tr("the peer selected us for high bandwidth relay") + "</li><li>\""
@ -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);