From b6013edbe40905732e8f74d19482745f4b51b528 Mon Sep 17 00:00:00 2001 From: Sami Ahmed Date: Fri, 27 Mar 2026 02:54:31 -0700 Subject: [PATCH] Suppress UI transaction notifications during initial block download During IBD, every wallet transaction triggers NotifyTransactionChanged which repaints the Qt transaction list. With thousands of staking rewards across 2M blocks, this floods the event loop and makes the wallet appear frozen ("not responding") for hours. Skip NotifyTransactionChanged during IsInitialBlockDownload(). The UI catches up naturally via refreshWallet() once sync completes. Co-Authored-By: Claude Opus 4.6 --- src/wallet.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/wallet.cpp b/src/wallet.cpp index c550e8a..cbf9123 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -486,7 +486,8 @@ void CWallet::WalletUpdateSpent(const CTransaction &tx, bool fBlock) printf("WalletUpdateSpent found spent coin %s TRI %s\n", FormatMoney(wtx.GetCredit()).c_str(), wtx.GetHash().ToString().c_str()); wtx.MarkSpent(txin.prevout.n); wtx.WriteToDisk(); - NotifyTransactionChanged(this, txin.prevout.hash, CT_UPDATED); + if (!IsInitialBlockDownload()) + NotifyTransactionChanged(this, txin.prevout.hash, CT_UPDATED); } } } @@ -503,7 +504,8 @@ void CWallet::WalletUpdateSpent(const CTransaction &tx, bool fBlock) { wtx.MarkUnspent(&txout - &tx.vout[0]); wtx.WriteToDisk(); - NotifyTransactionChanged(this, hash, CT_UPDATED); + if (!IsInitialBlockDownload()) + NotifyTransactionChanged(this, hash, CT_UPDATED); } } } @@ -634,8 +636,9 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn) // since AddToWallet is called directly for self-originating transactions, check for consumption of own coins WalletUpdateSpent(wtx, (wtxIn.hashBlock != 0)); - // Notify UI of new or updated transaction - NotifyTransactionChanged(this, hash, fInsertedNew ? CT_NEW : CT_UPDATED); + // Notify UI of new or updated transaction (skip during IBD to avoid flooding the event loop) + if (!IsInitialBlockDownload()) + NotifyTransactionChanged(this, hash, fInsertedNew ? CT_NEW : CT_UPDATED); // notify an external script when a wallet transaction comes in or is updated std::string strCmd = GetArg("-walletnotify", ""); @@ -2775,7 +2778,7 @@ void CWallet::UpdatedTransaction(const uint256 &hashTx) LOCK(cs_wallet); // Only notify UI if this transaction is in this wallet map::const_iterator mi = mapWallet.find(hashTx); - if (mi != mapWallet.end()) + if (mi != mapWallet.end() && !IsInitialBlockDownload()) NotifyTransactionChanged(this, hashTx, CT_UPDATED); } }