aboutsummaryrefslogtreecommitdiff
path: root/src/qt/clientmodel.cpp
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-04-10 18:17:22 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-04-16 18:59:02 +0200
commit48f6d39659e40f44907a7c09f839df988e6c6206 (patch)
treefc3a2c444f79791824e4487353f6dd39688f17bb /src/qt/clientmodel.cpp
parent36b12af7eeb571efccd972b2f732a81ae7310066 (diff)
downloadbitcoin-48f6d39659e40f44907a7c09f839df988e6c6206.tar.xz
qt: Revamp ClientModel code to handle BannedListChanged core signal
No behavior change.
Diffstat (limited to 'src/qt/clientmodel.cpp')
-rw-r--r--src/qt/clientmodel.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 3370338bc9..6677d353b2 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -24,6 +24,7 @@
#include <functional>
#include <QDebug>
+#include <QMetaObject>
#include <QThread>
#include <QTimer>
@@ -215,19 +216,7 @@ QString ClientModel::blocksDir() const
return GUIUtil::PathToQString(gArgs.GetBlocksDirPath());
}
-void ClientModel::updateBanlist()
-{
- banTableModel->refresh();
-}
-
// Handlers for core signals
-static void BannedListChanged(ClientModel *clientmodel)
-{
- qDebug() << QString("%1: Requesting update for peer banlist").arg(__func__);
- bool invoked = QMetaObject::invokeMethod(clientmodel, "updateBanlist", Qt::QueuedConnection);
- assert(invoked);
-}
-
static void BlockTipChanged(ClientModel* clientmodel, SynchronizationState sync_state, interfaces::BlockTip tip, double verificationProgress, bool fHeader)
{
if (fHeader) {
@@ -277,7 +266,11 @@ void ClientModel::subscribeToCoreSignals()
qDebug() << "ClientModel: NotifyAlertChanged";
Q_EMIT alertsChanged(getStatusBarWarnings());
});
- m_handler_banned_list_changed = m_node.handleBannedListChanged(std::bind(BannedListChanged, this));
+ m_handler_banned_list_changed = m_node.handleBannedListChanged(
+ [this]() {
+ qDebug() << "ClienModel: Requesting update for peer banlist";
+ QMetaObject::invokeMethod(banTableModel, [this] { banTableModel->refresh(); });
+ });
m_handler_notify_block_tip = m_node.handleNotifyBlockTip(std::bind(BlockTipChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, false));
m_handler_notify_header_tip = m_node.handleNotifyHeaderTip(std::bind(BlockTipChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, true));
}