Skip to content

Commit a8f3acc

Browse files
committed
fix: trigger manual re-fetch only if checkbox state changed
1 parent 5854199 commit a8f3acc

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

src/qt/masternodelist.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,21 +250,18 @@ void MasternodeList::updateDIP3List()
250250

251251
// Update filters
252252
if (walletModel && ui->checkBoxOwned->isChecked()) {
253-
updateMyMasternodeHashes();
253+
updateMyMasternodeHashes(mnList);
254254
}
255255

256256
updateFilteredCount();
257257
}
258258

259-
void MasternodeList::updateMyMasternodeHashes()
259+
void MasternodeList::updateMyMasternodeHashes(const interfaces::MnListPtr& mnList)
260260
{
261-
if (!clientModel || !walletModel) {
261+
if (!walletModel || !mnList) {
262262
return;
263263
}
264264

265-
auto [mnList, pindex] = clientModel->getMasternodeList();
266-
if (!pindex) return;
267-
268265
std::set<COutPoint> setOutpts;
269266
for (const auto& outpt : walletModel->wallet().listProTxCoins()) {
270267
setOutpts.emplace(outpt);
@@ -313,8 +310,11 @@ void MasternodeList::on_comboBoxType_currentIndexChanged(int index)
313310
void MasternodeList::on_checkBoxOwned_stateChanged(int state)
314311
{
315312
m_proxy_model->setShowOwnedOnly(state == Qt::Checked);
316-
if (state == Qt::Checked) {
317-
updateMyMasternodeHashes();
313+
if (clientModel && state == Qt::Checked) {
314+
auto [mnList, pindex] = clientModel->getMasternodeList();
315+
if (mnList) {
316+
updateMyMasternodeHashes(mnList);
317+
}
318318
} else {
319319
m_proxy_model->forceInvalidateFilter();
320320
}

src/qt/masternodelist.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@
1414
#include <QWidget>
1515

1616
#include <atomic>
17+
#include <memory>
1718
#include <set>
1819

20+
namespace interfaces {
21+
class MnList;
22+
using MnListPtr = std::shared_ptr<MnList>;
23+
} // namespace interfaces
1924
namespace Ui {
2025
class MasternodeList;
2126
} // namespace Ui
@@ -89,7 +94,7 @@ class MasternodeList : public QWidget
8994
const MasternodeEntry* GetSelectedEntry();
9095

9196
void updateDIP3List();
92-
void updateMyMasternodeHashes();
97+
void updateMyMasternodeHashes(const interfaces::MnListPtr& mnList);
9398

9499
Q_SIGNALS:
95100
void doubleClicked(const QModelIndex&);

0 commit comments

Comments
 (0)