mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-21 17:42:37 +02:00
Merge g677 via fix_qt_peers_na
This commit is contained in:
commit
db82f05cfd
@ -3805,6 +3805,10 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||
// Change version
|
||||
const int greatest_common_version = std::min(nVersion, PROTOCOL_VERSION);
|
||||
pfrom.SetCommonVersion(greatest_common_version);
|
||||
{
|
||||
LOCK(pfrom.m_subver_mutex);
|
||||
pfrom.cleanSubVer = cleanSubVer;
|
||||
}
|
||||
pfrom.nVersion = nVersion;
|
||||
|
||||
if (greatest_common_version >= WTXID_RELAY_VERSION) {
|
||||
@ -3823,10 +3827,6 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||
pfrom.m_has_all_wanted_services = HasAllDesirableServiceFlags(nServices);
|
||||
peer->m_their_services = nServices;
|
||||
pfrom.SetAddrLocal(addrMe);
|
||||
{
|
||||
LOCK(pfrom.m_subver_mutex);
|
||||
pfrom.cleanSubVer = cleanSubVer;
|
||||
}
|
||||
peer->m_starting_height = starting_height;
|
||||
|
||||
// Only initialize the Peer::TxRelay m_relay_txs data structure if:
|
||||
|
@ -1144,7 +1144,7 @@
|
||||
<height>426</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1">
|
||||
<layout class="QGridLayout" name="peerDetailsGrid" columnstretch="0,1">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_30">
|
||||
<property name="text">
|
||||
|
@ -717,7 +717,10 @@ void RPCConsole::setClientModel(ClientModel *model, int bestblock_height, int64_
|
||||
connect(ui->peerWidget, &QTableView::customContextMenuRequested, this, &RPCConsole::showPeersTableContextMenu);
|
||||
|
||||
// peer table signal handling - update peer details when selecting new node
|
||||
connect(ui->peerWidget->selectionModel(), &QItemSelectionModel::selectionChanged, this, &RPCConsole::updateDetailWidget);
|
||||
connect(ui->peerWidget->selectionModel(), &QItemSelectionModel::selectionChanged, [this] {
|
||||
resetDetailWidget();
|
||||
updateDetailWidget();
|
||||
});
|
||||
connect(model->getPeerTableModel(), &QAbstractItemModel::dataChanged, [this] { updateDetailWidget(); });
|
||||
|
||||
// set up ban table
|
||||
@ -1181,6 +1184,15 @@ void RPCConsole::updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut)
|
||||
ui->lblBytesOut->setText(GUIUtil::formatBytes(totalBytesOut));
|
||||
}
|
||||
|
||||
void RPCConsole::resetDetailWidget()
|
||||
{
|
||||
for (int row = 0; QLayoutItem * const item = ui->peerDetailsGrid->itemAtPosition(row, 1); ++row) {
|
||||
QLabel * const value_label = qobject_cast<QLabel*>(item->widget());
|
||||
if (!value_label) continue;
|
||||
value_label->setText(ts.na);
|
||||
}
|
||||
}
|
||||
|
||||
void RPCConsole::updateDetailWidget()
|
||||
{
|
||||
const QList<QModelIndex> selected_peers = GUIUtil::getEntryData(ui->peerWidget, PeerTableModel::NetNodeId);
|
||||
@ -1213,8 +1225,6 @@ void RPCConsole::updateDetailWidget()
|
||||
ui->peerMinPing->setText(GUIUtil::formatPingTime(stats->nodeStats.m_min_ping_time));
|
||||
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));
|
||||
@ -1229,7 +1239,7 @@ void RPCConsole::updateDetailWidget()
|
||||
}
|
||||
ui->peerNetwork->setText(GUIUtil::NetworkToQString(stats->nodeStats.m_network));
|
||||
if (stats->nodeStats.m_permission_flags == NetPermissionFlags::None) {
|
||||
ui->peerPermissions->setText(ts.na);
|
||||
ui->peerPermissions->setText(ts.no_permissions);
|
||||
} else {
|
||||
QStringList permissions;
|
||||
for (const auto& permission : NetPermissions::ToStrings(stats->nodeStats.m_permission_flags)) {
|
||||
|
@ -103,6 +103,8 @@ private Q_SLOTS:
|
||||
void showOrHideBanTableIfRequired();
|
||||
/** clear the selected node */
|
||||
void clearSelectedNode();
|
||||
/** reset all fields in UI detailed information to N/A */
|
||||
void resetDetailWidget();
|
||||
/** show detailed information on ui about selected node */
|
||||
void updateDetailWidget();
|
||||
|
||||
@ -142,7 +144,7 @@ public Q_SLOTS:
|
||||
private:
|
||||
struct TranslatedStrings {
|
||||
const QString yes{tr("Yes")}, no{tr("No")}, to{tr("To")}, from{tr("From")},
|
||||
ban_for{tr("Ban for")}, na{tr("N/A")}, unknown{tr("Unknown")};
|
||||
ban_for{tr("Ban for")}, na{tr("N/A")}, unknown{tr("Unknown")}, no_permissions{tr("None")};
|
||||
} const ts;
|
||||
|
||||
void startExecutor();
|
||||
|
Loading…
Reference in New Issue
Block a user