Skip to content

Commit

Permalink
[GUI] Topbar: don't try to poll for data if shutdown was requested.
Browse files Browse the repository at this point in the history
  • Loading branch information
furszy committed Jan 23, 2021
1 parent 6b9088b commit f17d80d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/qt/pivx/topbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,13 @@ void TopBar::setStakingStatusActive(bool fActive)
}
void TopBar::updateStakingStatus()
{
setStakingStatusActive(walletModel &&
!walletModel->isWalletLocked() &&
walletModel->isStakingStatusActive());
if (walletModel && !walletModel->isShutdownRequested()) {
setStakingStatusActive(!walletModel->isWalletLocked() &&
walletModel->isStakingStatusActive());

// Taking advantage of this timer to update Tor status if needed.
updateTorIcon();
// Taking advantage of this timer to update Tor status if needed.
updateTorIcon();
}
}

void TopBar::setNumConnections(int count)
Expand Down
6 changes: 6 additions & 0 deletions src/qt/walletmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "optionsmodel.h"
#include "recentrequeststablemodel.h"
#include "transactiontablemodel.h"
#include "init.h" // for ShutdownRequested(). Future: move to an interface wrapper

#include "base58.h"
#include "coincontrol.h"
Expand Down Expand Up @@ -67,6 +68,11 @@ bool WalletModel::isRegTestNetwork() const
return Params().IsRegTestNet();
}

bool WalletModel::isShutdownRequested()
{
return ShutdownRequested();
}

bool WalletModel::isColdStakingNetworkelyEnabled() const
{
return !sporkManager.IsSporkActive(SPORK_19_COLDSTAKING_MAINTENANCE);
Expand Down
1 change: 1 addition & 0 deletions src/qt/walletmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class WalletModel : public QObject

bool isTestNetwork() const;
bool isRegTestNetwork() const;
bool isShutdownRequested();
/** Whether cold staking is enabled or disabled in the network **/
bool isColdStakingNetworkelyEnabled() const;
bool isSaplingInMaintenance() const;
Expand Down

0 comments on commit f17d80d

Please sign in to comment.