@@ -36,6 +36,7 @@ WalletModel::WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *p
3636{
3737 fProcessingQueuedTransactions = false ;
3838 fHaveWatchOnly = wallet->HaveWatchOnly ();
39+ fForceCheckBalanceChanged = false ;
3940
4041 addressTableModel = new AddressTableModel (wallet, this );
4142 transactionTableModel = new TransactionTableModel (wallet, this );
@@ -121,8 +122,10 @@ void WalletModel::pollBalanceChanged()
121122 if (!lockWallet)
122123 return ;
123124
124- if (chainActive.Height () != cachedNumBlocks)
125+ if (fForceCheckBalanceChanged || chainActive.Height () != cachedNumBlocks)
125126 {
127+ fForceCheckBalanceChanged = false ;
128+
126129 // Balance and number of transactions might have changed
127130 cachedNumBlocks = chainActive.Height ();
128131
@@ -167,7 +170,7 @@ void WalletModel::updateTransaction(const QString &hash, int status)
167170 transactionTableModel->updateTransaction (hash, status);
168171
169172 // Balance and number of transactions might have changed
170- checkBalanceChanged () ;
173+ fForceCheckBalanceChanged = true ;
171174}
172175
173176void WalletModel::updateAddressBook (const QString &address, const QString &label,
@@ -344,6 +347,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran
344347 }
345348 emit coinsSent (wallet, rcp, transaction_array);
346349 }
350+ checkBalanceChanged (); // update balance immediately, otherwise there could be a short noticeable delay until pollBalanceChanged hits
347351
348352 return SendCoinsReturn (OK);
349353}
@@ -473,11 +477,6 @@ static void NotifyTransactionChanged(WalletModel *walletmodel, CWallet *wallet,
473477
474478static void ShowProgress (WalletModel *walletmodel, const std::string &title, int nProgress)
475479{
476- // emits signal "showProgress"
477- QMetaObject::invokeMethod (walletmodel, " showProgress" , Qt::QueuedConnection,
478- Q_ARG (QString, QString::fromStdString (title)),
479- Q_ARG (int , nProgress));
480-
481480 if (nProgress == 0 )
482481 fQueueNotifications = true ;
483482
@@ -495,6 +494,11 @@ static void ShowProgress(WalletModel *walletmodel, const std::string &title, int
495494 }
496495 std::vector<std::pair<uint256, ChangeType> >().swap (vQueueNotifications); // clear
497496 }
497+
498+ // emits signal "showProgress"
499+ QMetaObject::invokeMethod (walletmodel, " showProgress" , Qt::QueuedConnection,
500+ Q_ARG (QString, QString::fromStdString (title)),
501+ Q_ARG (int , nProgress));
498502}
499503
500504static void NotifyWatchonlyChanged (WalletModel *walletmodel, bool fHaveWatchonly )
0 commit comments