diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui index 9e828ce0a6f..e45cafe48a1 100644 --- a/src/qt/forms/debugwindow.ui +++ b/src/qt/forms/debugwindow.ui @@ -1079,7 +1079,7 @@ - The direction and type of peer connection: %1 + The direction and type of peer connection: %1 Direction/Type @@ -1342,14 +1342,17 @@ - + + + Elapsed time since a novel block passing initial validity checks was received from this peer. + - Last Send + Last Block - + IBeamCursor @@ -1365,14 +1368,17 @@ - + + + Elapsed time since a novel transaction accepted into our mempool was received from this peer. + - Last Receive + Last Tx - + IBeamCursor @@ -1388,14 +1394,14 @@ - + - Sent + Last Send - + IBeamCursor @@ -1411,14 +1417,14 @@ - + - Received + Last Receive - + IBeamCursor @@ -1434,14 +1440,14 @@ - + - Ping Time + Sent - + IBeamCursor @@ -1457,17 +1463,14 @@ - - - The duration of a currently outstanding ping. - + - Ping Wait + Received - + IBeamCursor @@ -1483,14 +1486,14 @@ - + - Min Ping + Ping Time - + IBeamCursor @@ -1506,14 +1509,17 @@ - + + + The duration of a currently outstanding ping. + - Time Offset + Ping Wait - + IBeamCursor @@ -1529,17 +1535,14 @@ - - - The mapped Autonomous System used for diversifying peer selection. - + - Mapped AS + Min Ping - + IBeamCursor @@ -1555,6 +1558,55 @@ + + + Time Offset + + + + + + + IBeamCursor + + + N/A + + + Qt::PlainText + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + The mapped Autonomous System used for diversifying peer selection. + + + Mapped AS + + + + + + + IBeamCursor + + + N/A + + + Qt::PlainText + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + Qt::Vertical diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 4a4b557acc9..5acf8b1cf02 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -1120,11 +1120,14 @@ void RPCConsole::updateDetailWidget() if (stats->nodeStats.m_bip152_highbandwidth_from) bip152_hb_settings += (bip152_hb_settings == "" ? "From" : "/From"); if (bip152_hb_settings == "") bip152_hb_settings = "No"; ui->peerHighBandwidth->setText(bip152_hb_settings); - ui->peerLastSend->setText(stats->nodeStats.nLastSend ? GUIUtil::formatDurationStr(GetSystemTimeInSeconds() - stats->nodeStats.nLastSend) : tr("never")); - ui->peerLastRecv->setText(stats->nodeStats.nLastRecv ? GUIUtil::formatDurationStr(GetSystemTimeInSeconds() - stats->nodeStats.nLastRecv) : tr("never")); + const int64_t time_now{GetSystemTimeInSeconds()}; + 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->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->peerMinPing->setText(GUIUtil::formatPingTime(stats->nodeStats.m_min_ping_usec)); ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset)); diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h index 5f308dc36da..27d4c42eb48 100644 --- a/src/qt/rpcconsole.h +++ b/src/qt/rpcconsole.h @@ -168,6 +168,11 @@ private: /** Update UI with latest network info from model. */ 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: void updateAlerts(const QString& warnings); };