diff options
author | Jon Atack <jon@atack.com> | 2022-09-16 16:17:27 +0200 |
---|---|---|
committer | Jon Atack <jon@atack.com> | 2022-10-05 15:19:01 +0200 |
commit | c2a21c06703fd20e314da8431220776c8f1cc08d (patch) | |
tree | 2e75f8dc857fb0e8fe90cad0ee50445cb37fd5b7 /src/qt | |
parent | b2e6d37b51f99d7af8d9a1396b1c9d207db59e58 (diff) | |
download | bitcoin-c2a21c06703fd20e314da8431220776c8f1cc08d.tar.xz |
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.
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/rpcconsole.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 295450d6b7..a07686ab2b 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -1178,8 +1178,12 @@ void RPCConsole::updateDetailWidget() ui->peerPingTime->setText(GUIUtil::formatPingTime(stats->nodeStats.m_last_ping_time)); ui->peerMinPing->setText(GUIUtil::formatPingTime(stats->nodeStats.m_min_ping_time)); ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset)); - ui->peerVersion->setText(QString::number(stats->nodeStats.nVersion)); - ui->peerSubversion->setText(QString::fromStdString(stats->nodeStats.cleanSubVer)); + if (stats->nodeStats.nVersion) { + ui->peerVersion->setText(QString::number(stats->nodeStats.nVersion)); + } + if (!stats->nodeStats.cleanSubVer.empty()) { + ui->peerSubversion->setText(QString::fromStdString(stats->nodeStats.cleanSubVer)); + } ui->peerConnectionType->setText(GUIUtil::ConnectionTypeToQString(stats->nodeStats.m_conn_type, /*prepend_direction=*/true)); ui->peerNetwork->setText(GUIUtil::NetworkToQString(stats->nodeStats.m_network)); if (stats->nodeStats.m_permission_flags == NetPermissionFlags::None) { |