Skip to content

Commit 48f6d39

Browse files
committed
qt: Revamp ClientModel code to handle BannedListChanged core signal
No behavior change.
1 parent 36b12af commit 48f6d39

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

src/qt/clientmodel.cpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <functional>
2525

2626
#include <QDebug>
27+
#include <QMetaObject>
2728
#include <QThread>
2829
#include <QTimer>
2930

@@ -215,19 +216,7 @@ QString ClientModel::blocksDir() const
215216
return GUIUtil::PathToQString(gArgs.GetBlocksDirPath());
216217
}
217218

218-
void ClientModel::updateBanlist()
219-
{
220-
banTableModel->refresh();
221-
}
222-
223219
// Handlers for core signals
224-
static void BannedListChanged(ClientModel *clientmodel)
225-
{
226-
qDebug() << QString("%1: Requesting update for peer banlist").arg(__func__);
227-
bool invoked = QMetaObject::invokeMethod(clientmodel, "updateBanlist", Qt::QueuedConnection);
228-
assert(invoked);
229-
}
230-
231220
static void BlockTipChanged(ClientModel* clientmodel, SynchronizationState sync_state, interfaces::BlockTip tip, double verificationProgress, bool fHeader)
232221
{
233222
if (fHeader) {
@@ -277,7 +266,11 @@ void ClientModel::subscribeToCoreSignals()
277266
qDebug() << "ClientModel: NotifyAlertChanged";
278267
Q_EMIT alertsChanged(getStatusBarWarnings());
279268
});
280-
m_handler_banned_list_changed = m_node.handleBannedListChanged(std::bind(BannedListChanged, this));
269+
m_handler_banned_list_changed = m_node.handleBannedListChanged(
270+
[this]() {
271+
qDebug() << "ClienModel: Requesting update for peer banlist";
272+
QMetaObject::invokeMethod(banTableModel, [this] { banTableModel->refresh(); });
273+
});
281274
m_handler_notify_block_tip = m_node.handleNotifyBlockTip(std::bind(BlockTipChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, false));
282275
m_handler_notify_header_tip = m_node.handleNotifyHeaderTip(std::bind(BlockTipChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, true));
283276
}

src/qt/clientmodel.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@ class ClientModel : public QObject
120120

121121
// Show progress dialog e.g. for verifychain
122122
void showProgress(const QString &title, int nProgress);
123-
124-
public Q_SLOTS:
125-
void updateBanlist();
126123
};
127124

128125
#endif // BITCOIN_QT_CLIENTMODEL_H

0 commit comments

Comments
 (0)