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 -getinfoto use the RPC
before
$ bitcoin-cli -getinfo -regtest
{
"version": 199900,
"blocks": 15599,
"headers": 15599,
"verificationprogress": 1,
"timeoffset": 0,
"connections": 0,
"proxy": "",
"difficulty": 4.656542373906925e-10,
"chain": "regtest",
"keypoolsize": 1000,
"paytxfee": 0.00000000,
"balance": 0.00001000,
"relayfee": 0.00001000
}
after
$ bitcoin-cli -getinfo -regtest
{
"version": 199900,
"blocks": 15599,
"headers": 15599,
"verificationprogress": 1,
"timeoffset": 0,
"connections": 0,
"proxy": "",
"difficulty": 4.656542373906925e-10,
"chain": "regtest",
"balances": {
"": 0.00001000,
"Encrypted": 0.00003500,
"day-to-day": 0.00000120,
"side project": 0.00000094
},
"relayfee": 0.00001000
}
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.