There are two major parts in this PR.
A) wallet: introduce a per-balance-type cache
Additionally to the per CWalletTx
debit, etc. caches, this adds an atomic cache for each balance type (available, immature, watchonly, etc.).
If the balance has been cached, no lock will be acquired when calling Get*Balance()
.
As always with caches, the problematic parts is where to invalidate it (that is why there are some calls to MarkBalancesDirty()
).
B) Signal for balance changes
This PR exposes a new wallet signal that will signal the GUI when a balance change had happened (instead of the 250ms polling timer).