[Lib] Performance: cache results of wallet.get_addr_balance() calls
[Lib] Performance: cache results of wallet.get_addr_balance() calls

Inspired by electrum commit 2abc4f63347c0c508558a74e425d7409cc92b05c

- Cache is from address -> c,u,x tuples
- Cache entries are invalidated on the address-level on reorg or
new address histories being seen
- Addresses receiving coinbase txo's do not ever get their balances
cached (this avoids having to keep track of changing maturity and/or
needing to invalidate the cache with each block found).

The cache is fast and on a wallet with >1000 addresses the cumulative
cost of the calls to get_addr_balance (eg in the Address tab refresh)
went from 20ms to 3-4ms per refresh.

Savings from using the cache will be more significant for larger wallets
with many addresses or many tx's in their history (such as CashShuffle
wallets).

fyookball/electrum,fyookball/electrum,fyookball/electrum