Skip to content

Commit

Permalink
qt, refactor: Drop redundant checks of walletModel
Browse files Browse the repository at this point in the history
The walletModel member is set in the WalletView constructor now.
  • Loading branch information
hebasto committed Aug 26, 2021
1 parent 404373b commit ca0e680
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/qt/walletview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,15 @@ void WalletView::setClientModel(ClientModel *_clientModel)

overviewPage->setClientModel(_clientModel);
sendCoinsPage->setClientModel(_clientModel);
if (walletModel) walletModel->setClientModel(_clientModel);
walletModel->setClientModel(_clientModel);
}

void WalletView::processNewTransaction(const QModelIndex& parent, int start, int /*end*/)
{
// Prevent balloon-spam when initial block download is in progress
if (!walletModel || !clientModel || clientModel->node().isInitialBlockDownload())
if (!clientModel || clientModel->node().isInitialBlockDownload()) {
return;
}

TransactionTableModel *ttm = walletModel->getTransactionTableModel();
if (!ttm || ttm->processingQueuedTransactions())
Expand Down Expand Up @@ -204,8 +205,6 @@ void WalletView::showOutOfSyncWarning(bool fShow)

void WalletView::encryptWallet()
{
if(!walletModel)
return;
AskPassphraseDialog dlg(AskPassphraseDialog::Encrypt, this);
dlg.setModel(walletModel);
dlg.exec();
Expand Down Expand Up @@ -242,8 +241,6 @@ void WalletView::changePassphrase()

void WalletView::unlockWallet()
{
if(!walletModel)
return;
// Unlock wallet when requested by wallet model
if (walletModel->getEncryptionStatus() == WalletModel::Locked)
{
Expand All @@ -255,17 +252,11 @@ void WalletView::unlockWallet()

void WalletView::usedSendingAddresses()
{
if(!walletModel)
return;

GUIUtil::bringToFront(usedSendingAddressesPage);
}

void WalletView::usedReceivingAddresses()
{
if(!walletModel)
return;

GUIUtil::bringToFront(usedReceivingAddressesPage);
}

Expand Down

0 comments on commit ca0e680

Please sign in to comment.