Skip to content

Commit 08818a7

Browse files
committed
fix: trigger manual re-fetch only if checkbox state changed
1 parent 909c0b1 commit 08818a7

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
@@ -256,21 +256,18 @@ void MasternodeList::updateDIP3List()
256256

257257
// Update filters
258258
if (walletModel && ui->checkBoxOwned->isChecked()) {
259-
updateMyMasternodeHashes();
259+
updateMyMasternodeHashes(mnList);
260260
}
261261

262262
updateFilteredCount();
263263
}
264264

265-
void MasternodeList::updateMyMasternodeHashes()
265+
void MasternodeList::updateMyMasternodeHashes(const interfaces::MnListPtr& mnList)
266266
{
267-
if (!clientModel || !walletModel) {
267+
if (!walletModel || !mnList) {
268268
return;
269269
}
270270

271-
auto [mnList, pindex] = clientModel->getMasternodeList();
272-
if (!pindex) return;
273-
274271
std::set<COutPoint> setOutpts;
275272
for (const auto& outpt : walletModel->wallet().listProTxCoins()) {
276273
setOutpts.emplace(outpt);
@@ -319,8 +316,11 @@ void MasternodeList::on_comboBoxType_currentIndexChanged(int index)
319316
void MasternodeList::on_checkBoxOwned_stateChanged(int state)
320317
{
321318
m_proxy_model->setShowOwnedOnly(state == Qt::Checked);
322-
if (state == Qt::Checked) {
323-
updateMyMasternodeHashes();
319+
if (clientModel && state == Qt::Checked) {
320+
auto [mnList, pindex] = clientModel->getMasternodeList();
321+
if (mnList) {
322+
updateMyMasternodeHashes(mnList);
323+
}
324324
} else {
325325
m_proxy_model->forceInvalidateFilter();
326326
}

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
@@ -92,7 +97,7 @@ class MasternodeList : public QWidget
9297
const MasternodeEntry* GetSelectedEntry();
9398

9499
void updateDIP3List();
95-
void updateMyMasternodeHashes();
100+
void updateMyMasternodeHashes(const interfaces::MnListPtr& mnList);
96101

97102
Q_SIGNALS:
98103
void doubleClicked(const QModelIndex&);

0 commit comments

Comments
 (0)