merge bitcoin-core/gui#226: Add "Last Block" and "Last Tx" rows to peer details area

This commit is contained in:
Kittywhiskers Van Gogh 2024-03-25 16:06:49 +00:00
parent 3e8ba24c87
commit 8b204c4c82
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
3 changed files with 96 additions and 36 deletions

View File

@ -1239,14 +1239,17 @@
</widget> </widget>
</item> </item>
<item row="13" column="0"> <item row="13" column="0">
<widget class="QLabel" name="label_15"> <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>
</property>
<property name="text"> <property name="text">
<string>Last Send</string> <string>Last Block</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="13" column="2"> <item row="13" column="2">
<widget class="QLabel" name="peerLastSend"> <widget class="QLabel" name="peerLastBlock">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -1262,14 +1265,17 @@
</widget> </widget>
</item> </item>
<item row="14" column="0"> <item row="14" column="0">
<widget class="QLabel" name="label_19"> <widget class="QLabel" name="peerLastTxLabel">
<property name="toolTip">
<string>Elapsed time since a novel transaction accepted into our mempool was received from this peer.</string>
</property>
<property name="text"> <property name="text">
<string>Last Receive</string> <string>Last Tx</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="14" column="2"> <item row="14" column="2">
<widget class="QLabel" name="peerLastRecv"> <widget class="QLabel" name="peerLastTx">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -1285,14 +1291,14 @@
</widget> </widget>
</item> </item>
<item row="15" column="0"> <item row="15" column="0">
<widget class="QLabel" name="label_18"> <widget class="QLabel" name="label_15">
<property name="text"> <property name="text">
<string>Sent</string> <string>Last Send</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="15" column="2"> <item row="15" column="2">
<widget class="QLabel" name="peerBytesSent"> <widget class="QLabel" name="peerLastSend">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -1308,14 +1314,14 @@
</widget> </widget>
</item> </item>
<item row="16" column="0"> <item row="16" column="0">
<widget class="QLabel" name="label_20"> <widget class="QLabel" name="label_19">
<property name="text"> <property name="text">
<string>Received</string> <string>Last Receive</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="16" column="2"> <item row="16" column="2">
<widget class="QLabel" name="peerBytesRecv"> <widget class="QLabel" name="peerLastRecv">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -1331,14 +1337,14 @@
</widget> </widget>
</item> </item>
<item row="17" column="0"> <item row="17" column="0">
<widget class="QLabel" name="label_26"> <widget class="QLabel" name="label_18">
<property name="text"> <property name="text">
<string>Ping Time</string> <string>Sent</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="17" column="2"> <item row="17" column="2">
<widget class="QLabel" name="peerPingTime"> <widget class="QLabel" name="peerBytesSent">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -1354,17 +1360,14 @@
</widget> </widget>
</item> </item>
<item row="18" column="0"> <item row="18" column="0">
<widget class="QLabel" name="peerPingWaitLabel"> <widget class="QLabel" name="label_20">
<property name="toolTip">
<string>The duration of a currently outstanding ping.</string>
</property>
<property name="text"> <property name="text">
<string>Ping Wait</string> <string>Received</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="18" column="2"> <item row="18" column="2">
<widget class="QLabel" name="peerPingWait"> <widget class="QLabel" name="peerBytesRecv">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -1380,14 +1383,14 @@
</widget> </widget>
</item> </item>
<item row="19" column="0"> <item row="19" column="0">
<widget class="QLabel" name="peerMinPingLabel"> <widget class="QLabel" name="label_26">
<property name="text"> <property name="text">
<string>Min Ping</string> <string>Ping Time</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="19" column="2"> <item row="19" column="2">
<widget class="QLabel" name="peerMinPing"> <widget class="QLabel" name="peerPingTime">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -1403,14 +1406,17 @@
</widget> </widget>
</item> </item>
<item row="20" column="0"> <item row="20" column="0">
<widget class="QLabel" name="label_timeoffset"> <widget class="QLabel" name="peerPingWaitLabel">
<property name="toolTip">
<string>The duration of a currently outstanding ping.</string>
</property>
<property name="text"> <property name="text">
<string>Time Offset</string> <string>Ping Wait</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="20" column="2"> <item row="20" column="2">
<widget class="QLabel" name="timeoffset"> <widget class="QLabel" name="peerPingWait">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -1426,17 +1432,14 @@
</widget> </widget>
</item> </item>
<item row="21" column="0"> <item row="21" column="0">
<widget class="QLabel" name="peerMappedASLabel"> <widget class="QLabel" name="peerMinPingLabel">
<property name="toolTip">
<string>The mapped Autonomous System used for diversifying peer selection.</string>
</property>
<property name="text"> <property name="text">
<string>Mapped AS</string> <string>Min Ping</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="21" column="2"> <item row="21" column="2">
<widget class="QLabel" name="peerMappedAS"> <widget class="QLabel" name="peerMinPing">
<property name="cursor"> <property name="cursor">
<cursorShape>IBeamCursor</cursorShape> <cursorShape>IBeamCursor</cursorShape>
</property> </property>
@ -1452,6 +1455,55 @@
</widget> </widget>
</item> </item>
<item row="22" column="0"> <item row="22" column="0">
<widget class="QLabel" name="label_timeoffset">
<property name="text">
<string>Time Offset</string>
</property>
</widget>
</item>
<item row="22" column="2">
<widget class="QLabel" name="timeoffset">
<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="23" column="0">
<widget class="QLabel" name="peerMappedASLabel">
<property name="toolTip">
<string>The mapped Autonomous System used for diversifying peer selection.</string>
</property>
<property name="text">
<string>Mapped AS</string>
</property>
</widget>
</item>
<item row="23" column="2">
<widget class="QLabel" name="peerMappedAS">
<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="24" column="0">
<spacer name="verticalSpacer_3"> <spacer name="verticalSpacer_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>

View File

@ -1244,11 +1244,14 @@ void RPCConsole::updateNodeDetail(const CNodeCombinedStats *stats)
ui->peerHeading->setText(peerAddrDetails); ui->peerHeading->setText(peerAddrDetails);
ui->peerServices->setText(GUIUtil::formatServicesStr(stats->nodeStats.nServices)); ui->peerServices->setText(GUIUtil::formatServicesStr(stats->nodeStats.nServices));
ui->peerRelayTxes->setText(stats->nodeStats.fRelayTxes ? "Yes" : "No"); ui->peerRelayTxes->setText(stats->nodeStats.fRelayTxes ? "Yes" : "No");
ui->peerLastSend->setText(stats->nodeStats.nLastSend ? GUIUtil::formatDurationStr(GetSystemTimeInSeconds() - stats->nodeStats.nLastSend) : tr("never")); const int64_t time_now{GetSystemTimeInSeconds()};
ui->peerLastRecv->setText(stats->nodeStats.nLastRecv ? GUIUtil::formatDurationStr(GetSystemTimeInSeconds() - stats->nodeStats.nLastRecv) : tr("never")); ui->peerConnTime->setText(GUIUtil::formatDurationStr(time_now - stats->nodeStats.nTimeConnected));
ui->peerLastBlock->setText(TimeDurationField(time_now, stats->nodeStats.nLastBlockTime));
ui->peerLastTx->setText(TimeDurationField(time_now, stats->nodeStats.nLastTXTime));
ui->peerLastSend->setText(TimeDurationField(time_now, stats->nodeStats.nLastSend));
ui->peerLastRecv->setText(TimeDurationField(time_now, stats->nodeStats.nLastRecv));
ui->peerBytesSent->setText(GUIUtil::formatBytes(stats->nodeStats.nSendBytes)); ui->peerBytesSent->setText(GUIUtil::formatBytes(stats->nodeStats.nSendBytes));
ui->peerBytesRecv->setText(GUIUtil::formatBytes(stats->nodeStats.nRecvBytes)); ui->peerBytesRecv->setText(GUIUtil::formatBytes(stats->nodeStats.nRecvBytes));
ui->peerConnTime->setText(GUIUtil::formatDurationStr(GetSystemTimeInSeconds() - stats->nodeStats.nTimeConnected));
ui->peerPingTime->setText(GUIUtil::formatPingTime(stats->nodeStats.m_ping_usec)); ui->peerPingTime->setText(GUIUtil::formatPingTime(stats->nodeStats.m_ping_usec));
ui->peerMinPing->setText(GUIUtil::formatPingTime(stats->nodeStats.m_min_ping_usec)); ui->peerMinPing->setText(GUIUtil::formatPingTime(stats->nodeStats.m_min_ping_usec));
ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset)); ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset));

View File

@ -194,6 +194,11 @@ private:
/** Update UI with latest network info from model. */ /** Update UI with latest network info from model. */
void updateNetworkState(); void updateNetworkState();
/** Helper for the output of a time duration field. Inputs are UNIX epoch times. */
QString TimeDurationField(uint64_t time_now, uint64_t time_at_event) const {
return time_at_event ? GUIUtil::formatDurationStr(time_now - time_at_event) : tr("Never");
}
private Q_SLOTS: private Q_SLOTS:
void updateAlerts(const QString& warnings); void updateAlerts(const QString& warnings);
}; };