This PR implements point 2 from #17314 (show balance per wallet):
- create an RPC that returns the ismine.trusted balance for all loaded wallets
- update
bitcoin-cli -getinfo
to use the RPC
before
0$ bitcoin-cli -getinfo -regtest
1{
2 "version": 199900,
3 "blocks": 15599,
4 "headers": 15599,
5 "verificationprogress": 1,
6 "timeoffset": 0,
7 "connections": 0,
8 "proxy": "",
9 "difficulty": 4.656542373906925e-10,
10 "chain": "regtest",
11 "keypoolsize": 1000,
12 "paytxfee": 0.00000000,
13 "balance": 0.00001000,
14 "relayfee": 0.00001000
15}
after
0$ bitcoin-cli -getinfo -regtest
1{
2 "version": 199900,
3 "blocks": 15599,
4 "headers": 15599,
5 "verificationprogress": 1,
6 "timeoffset": 0,
7 "connections": 0,
8 "proxy": "",
9 "difficulty": 4.656542373906925e-10,
10 "chain": "regtest",
11 "balances": {
12 "": 0.00001000,
13 "Encrypted": 0.00003500,
14 "day-to-day": 0.00000120,
15 "side project": 0.00000094
16 },
17 "relayfee": 0.00001000
18}
Review club
discussion about this PR is here: https://bitcoincore.reviews/18453.
This approach is simpler, adds no additional rpc calls in -getinfo and runs faster than doing it on the client side inside bitcoin-cli.cpp, but it also adds the first multiwallet RPC and would need to be well-considered in terms of the API.