Skip to content
Bitcoin Roots

v31.1-roots.1 · Commit 5: [PATCH 05/17] feat(net): preserve Roots peer controls and health view on v31

src/qt/rpcconsole.cpp

Before: src/qt/rpcconsole.cpp · After: src/qt/rpcconsole.cpp

File metadata
index d30a8acff623f73864c00cd5d97e843025877ae5..70079699e7d4c7006af31072f459e5affbaed7a4 100644

Download original patch · Release notes

Diff rows 1–45 of 45. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

src/qt/rpcconsole.cpp CHANGED
@@ -1184,6 +1184,7 @@ void RPCConsole::updateDetailWidget()
1184
1184
  ui->peerSessionId->setVisible(true);
1185
1185
  ui->peerSessionId->setText(QString::fromStdString(stats->nodeStats.m_session_id));
1186
1186
  } else {
1187
+ ui->peerSessionId->clear();
1187
1188
  ui->peerSessionIdLabel->setVisible(false);
1188
1189
  ui->peerSessionId->setVisible(false);
1189
1190
  }
@@ -1199,6 +1200,8 @@ void RPCConsole::updateDetailWidget()
1199
1200
  }
1200
1201
  ui->peerMappedAS->setText(stats->nodeStats.m_mapped_as != 0 ? QString::number(stats->nodeStats.m_mapped_as) : ts.na);
1201
1202
 
1203
+ resetPeerStateStats();
1204
+
1202
1205
  // This check fails for example if the lock was busy and
1203
1206
  // nodeStateStats couldn't be fetched.
1204
1207
  if (stats->fNodeStateStatsAvailable) {
@@ -1216,6 +1219,7 @@ void RPCConsole::updateDetailWidget()
1216
1219
  } else {
1217
1220
  ui->peerCommonHeight->setText(ts.unknown);
1218
1221
  }
1222
+ ui->peerHeight->setText(stats->nodeStateStats.m_starting_height >= 0 ? QString::number(stats->nodeStateStats.m_starting_height) : ts.unknown);
1219
1223
  ui->peerPingWait->setText(GUIUtil::formatPingTime(stats->nodeStateStats.m_ping_wait));
1220
1224
  ui->peerAddrRelayEnabled->setText(stats->nodeStateStats.m_addr_relay_enabled ? ts.yes : ts.no);
1221
1225
  ui->peerAddrProcessed->setText(QString::number(stats->nodeStateStats.m_addr_processed));
@@ -1227,6 +1231,23 @@ void RPCConsole::updateDetailWidget()
1227
1231
  ui->peersTabRightPanel->show();
1228
1232
  }
1229
1233
 
1234
+ void RPCConsole::resetPeerStateStats()
1235
+ {
1236
+ // State stats can be unavailable when the non-blocking cs_main acquisition
1237
+ // loses a refresh race. Clear them first so a newly selected peer never
1238
+ // shows state from an earlier selection.
1239
+ ui->timeoffset->setText(ts.na);
1240
+ ui->peerServices->setText(ts.na);
1241
+ ui->peerSyncHeight->setText(ts.unknown);
1242
+ ui->peerCommonHeight->setText(ts.unknown);
1243
+ ui->peerHeight->setText(ts.unknown);
1244
+ ui->peerPingWait->setText(ts.na);
1245
+ ui->peerAddrRelayEnabled->setText(ts.na);
1246
+ ui->peerAddrProcessed->setText(ts.na);
1247
+ ui->peerAddrRateLimited->setText(ts.na);
1248
+ ui->peerRelayTxes->setText(ts.na);
1249
+ }
1250
+
1230
1251
  void RPCConsole::resizeEvent(QResizeEvent *event)
1231
1252
  {
1232
1253
  QWidget::resizeEvent(event);