bitcoin/bitcoin — pull request #4712 by cozz (2014-08-17 01:26:01+00:00)
Title: [Qt] Call checkBalanceChanged() periodically instead for every updated tx

checkBalanceChanged() is quite expensive on larger wallets as we loop mapWallet
several times for each balance-type.

There already is a periodical function pollBalanceChanged().
So instead of calling checkBalanceChanged() for each updated transaction, set a flag
fForceCheckBalanceChanged, which forces pollBalanceChanged() to check the balance
on the next run.

For example
importaddress mvqaxopu9Uef2qjXSV3fGrp6DcEYnCoYWK
adds like 40000 transactions to the wallet.
This means after rescan currently we loop mapWallet 240000 times,
just to check the balance, which causes 100% cpu for a while.

Unrelated change: Move showProgress signal after the QueueProcessing, so that the progressbar is still shown, while the 40000 txs get added to the GUI.