diff --git a/src/evo/deterministicmns.cpp b/src/evo/deterministicmns.cpp index e1e40a61a..bf1b9d74a 100644 --- a/src/evo/deterministicmns.cpp +++ b/src/evo/deterministicmns.cpp @@ -504,6 +504,7 @@ bool CDeterministicMNManager::ProcessBlock(const CBlock& block, const CBlockInde // Don't hold cs while calling signals if (diff.HasChanges()) { GetMainSignals().NotifyMasternodeListChanged(false, oldList, diff); + uiInterface.NotifyMasternodeListChanged(); } const auto& consensusParams = Params().GetConsensus(); @@ -549,6 +550,7 @@ bool CDeterministicMNManager::UndoBlock(const CBlock& block, const CBlockIndex* if (diff.HasChanges()) { auto inversedDiff = curList.BuildDiff(prevList); GetMainSignals().NotifyMasternodeListChanged(true, curList, inversedDiff); + uiInterface.NotifyMasternodeListChanged(); } const auto& consensusParams = Params().GetConsensus(); diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 730de5bc0..1ba75e691 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -351,11 +351,15 @@ static void BlockTipChanged(ClientModel *clientmodel, bool initialSync, const CB Q_ARG(bool, fHeader)); nLastUpdateNotification = now; } +} +static void NotifyMasternodeListChanged(ClientModel *clientmodel) +{ static int64_t nLastMasternodeUpdateNotification = 0; + int64_t now = GetTimeMillis(); // if we are in-sync, update the UI regardless of last update time // no need to refresh masternode list/stats as often as blocks etc. - if (!initialSync || now - nLastMasternodeUpdateNotification > MODEL_UPDATE_DELAY*4*5) { + if (masternodeSync.IsBlockchainSynced() || now - nLastMasternodeUpdateNotification > MODEL_UPDATE_DELAY*4*5) { clientmodel->refreshMasternodeList(); nLastMasternodeUpdateNotification = now; } @@ -377,6 +381,7 @@ void ClientModel::subscribeToCoreSignals() uiInterface.BannedListChanged.connect(boost::bind(BannedListChanged, this)); uiInterface.NotifyBlockTip.connect(boost::bind(BlockTipChanged, this, _1, _2, false)); uiInterface.NotifyHeaderTip.connect(boost::bind(BlockTipChanged, this, _1, _2, true)); + uiInterface.NotifyMasternodeListChanged.connect(boost::bind(NotifyMasternodeListChanged, this)); uiInterface.NotifyAdditionalDataSyncProgressChanged.connect(boost::bind(NotifyAdditionalDataSyncProgressChanged, this, _1)); } @@ -390,5 +395,6 @@ void ClientModel::unsubscribeFromCoreSignals() uiInterface.BannedListChanged.disconnect(boost::bind(BannedListChanged, this)); uiInterface.NotifyBlockTip.disconnect(boost::bind(BlockTipChanged, this, _1, _2, false)); uiInterface.NotifyHeaderTip.disconnect(boost::bind(BlockTipChanged, this, _1, _2, true)); + uiInterface.NotifyMasternodeListChanged.disconnect(boost::bind(NotifyMasternodeListChanged, this)); uiInterface.NotifyAdditionalDataSyncProgressChanged.disconnect(boost::bind(NotifyAdditionalDataSyncProgressChanged, this, _1)); } diff --git a/src/ui_interface.h b/src/ui_interface.h index f28a5598d..98c882d63 100644 --- a/src/ui_interface.h +++ b/src/ui_interface.h @@ -110,6 +110,9 @@ public: /** Best header has changed */ boost::signals2::signal NotifyHeaderTip; + /** Masternode list has changed */ + boost::signals2::signal NotifyMasternodeListChanged; + /** Additional data sync progress changed */ boost::signals2::signal NotifyAdditionalDataSyncProgressChanged;