v29.4-roots.3 · Commit 15: [PATCH 15/30] fix(qt): clear stale peer details on refresh
src/qt/rpcconsole.cpp
Before: src/qt/rpcconsole.cpp · After: src/qt/rpcconsole.cpp
File metadata
index 9d7c17ac91152e0a32c9c09fda5b0f4bd4f14049..b2fb8e2b2c187992de08cc469b884bcd63ed02e5 100644
Download original patch · Release notes
Diff rows 1–43 of 43. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
src/qt/rpcconsole.cpp
CHANGED
|
@@ -1213,6 +1213,8 @@ void RPCConsole::updateDetailWidget()
|
|
| 1213 |
ui->peerBytesRecv->setText(GUIUtil::formatBytes(stats->nodeStats.nRecvBytes));
|
| 1214 |
ui->peerPingTime->setText(GUIUtil::formatPingTime(stats->nodeStats.m_last_ping_time));
|
| 1215 |
ui->peerMinPing->setText(GUIUtil::formatPingTime(stats->nodeStats.m_min_ping_time));
|
|
|
|
|
|
|
| 1216 |
if (stats->nodeStats.nVersion) {
|
| 1217 |
ui->peerVersion->setText(QString::number(stats->nodeStats.nVersion));
|
| 1218 |
}
|
|
@@ -1241,8 +1243,10 @@ void RPCConsole::updateDetailWidget()
|
|
| 1241 |
}
|
| 1242 |
ui->peerMappedAS->setText(stats->nodeStats.m_mapped_as != 0 ? QString::number(stats->nodeStats.m_mapped_as) : ts.na);
|
| 1243 |
|
| 1244 |
-
// This check fails for example if the lock was busy and
|
| 1245 |
-
// nodeStateStats couldn't be fetched.
|
|
|
|
|
|
|
| 1246 |
if (stats->fNodeStateStatsAvailable) {
|
| 1247 |
ui->timeoffset->setText(GUIUtil::formatTimeOffset(Ticks<std::chrono::seconds>(stats->nodeStateStats.time_offset)));
|
| 1248 |
ui->peerServices->setText(GUIUtil::formatServicesStr(stats->nodeStateStats.their_services));
|
|
@@ -1270,6 +1274,23 @@ void RPCConsole::updateDetailWidget()
|
|
| 1270 |
ui->peersTabRightPanel->show();
|
| 1271 |
}
|
| 1272 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1273 |
void RPCConsole::resizeEvent(QResizeEvent *event)
|
| 1274 |
{
|
| 1275 |
QWidget::resizeEvent(event);
|
|
|
|
| 1213 |
ui->peerBytesRecv->setText(GUIUtil::formatBytes(stats->nodeStats.nRecvBytes));
|
| 1214 |
ui->peerPingTime->setText(GUIUtil::formatPingTime(stats->nodeStats.m_last_ping_time));
|
| 1215 |
ui->peerMinPing->setText(GUIUtil::formatPingTime(stats->nodeStats.m_min_ping_time));
|
| 1216 |
+
ui->peerVersion->setText(ts.na);
|
| 1217 |
+
ui->peerSubversion->setText(ts.na);
|
| 1218 |
if (stats->nodeStats.nVersion) {
|
| 1219 |
ui->peerVersion->setText(QString::number(stats->nodeStats.nVersion));
|
| 1220 |
}
|
|
|
|
| 1243 |
}
|
| 1244 |
ui->peerMappedAS->setText(stats->nodeStats.m_mapped_as != 0 ? QString::number(stats->nodeStats.m_mapped_as) : ts.na);
|
| 1245 |
|
| 1246 |
+
resetPeerStateStats();
|
| 1247 |
+
|
| 1248 |
+
// This check fails, for example, if the lock was busy and node state stats
|
| 1249 |
+
// could not be fetched.
|
| 1250 |
if (stats->fNodeStateStatsAvailable) {
|
| 1251 |
ui->timeoffset->setText(GUIUtil::formatTimeOffset(Ticks<std::chrono::seconds>(stats->nodeStateStats.time_offset)));
|
| 1252 |
ui->peerServices->setText(GUIUtil::formatServicesStr(stats->nodeStateStats.their_services));
|
|
|
|
| 1274 |
ui->peersTabRightPanel->show();
|
| 1275 |
}
|
| 1276 |
|
| 1277 |
+
void RPCConsole::resetPeerStateStats()
|
| 1278 |
+
{
|
| 1279 |
+
// State stats can be unavailable when the non-blocking cs_main acquisition
|
| 1280 |
+
// loses a refresh race. Clear them first so a newly selected peer never
|
| 1281 |
+
// shows state from an earlier selection.
|
| 1282 |
+
ui->timeoffset->setText(ts.na);
|
| 1283 |
+
ui->peerServices->setText(ts.na);
|
| 1284 |
+
ui->peerSyncHeight->setText(ts.unknown);
|
| 1285 |
+
ui->peerCommonHeight->setText(ts.unknown);
|
| 1286 |
+
ui->peerHeight->setText(ts.unknown);
|
| 1287 |
+
ui->peerPingWait->setText(ts.na);
|
| 1288 |
+
ui->peerAddrRelayEnabled->setText(ts.na);
|
| 1289 |
+
ui->peerAddrProcessed->setText(ts.na);
|
| 1290 |
+
ui->peerAddrRateLimited->setText(ts.na);
|
| 1291 |
+
ui->peerRelayTxes->setText(ts.na);
|
| 1292 |
+
}
|
| 1293 |
+
|
| 1294 |
void RPCConsole::resizeEvent(QResizeEvent *event)
|
| 1295 |
{
|
| 1296 |
QWidget::resizeEvent(event);
|