Skip to content

Commit c2a21c0

Browse files
committed
gui: use fallback value for Version and User Agent during peer connection
During connection setup for a peer, getpeerinfo returns "version": 0, "subver": "" and the GUI Peers window displays 0 and an empty field, respectively. Give these fields the same behavior as the other fields in the GUI Peers window: display the fallback value in src/qt/forms/debugwindow.ui (i.e. "N/A") until a valid result is available after the peer connection completes.
1 parent b2e6d37 commit c2a21c0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/qt/rpcconsole.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,8 +1178,12 @@ void RPCConsole::updateDetailWidget()
11781178
ui->peerPingTime->setText(GUIUtil::formatPingTime(stats->nodeStats.m_last_ping_time));
11791179
ui->peerMinPing->setText(GUIUtil::formatPingTime(stats->nodeStats.m_min_ping_time));
11801180
ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset));
1181-
ui->peerVersion->setText(QString::number(stats->nodeStats.nVersion));
1182-
ui->peerSubversion->setText(QString::fromStdString(stats->nodeStats.cleanSubVer));
1181+
if (stats->nodeStats.nVersion) {
1182+
ui->peerVersion->setText(QString::number(stats->nodeStats.nVersion));
1183+
}
1184+
if (!stats->nodeStats.cleanSubVer.empty()) {
1185+
ui->peerSubversion->setText(QString::fromStdString(stats->nodeStats.cleanSubVer));
1186+
}
11831187
ui->peerConnectionType->setText(GUIUtil::ConnectionTypeToQString(stats->nodeStats.m_conn_type, /*prepend_direction=*/true));
11841188
ui->peerNetwork->setText(GUIUtil::NetworkToQString(stats->nodeStats.m_network));
11851189
if (stats->nodeStats.m_permission_flags == NetPermissionFlags::None) {

0 commit comments

Comments
 (0)