This PR is a client-side version of #18453, per review feedback there and review club discussions. It updates bitcoin-cli -getinfo
on the client side to display wallet name and balance for the loaded wallets when more than one is loaded (e.g. you are in “multiwallet mode”) and -rpcwallet=
is not passed; otherwise, behavior is unchanged.
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 "balance": 0.00001000,
12 "relayfee": 0.00001000
13}
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}
Review club
discussion about this PR is here: https://bitcoincore.reviews/18453
This PR can be manually tested by building, creating/loading/unloading several wallets with bitcoin-cli createwallet/loadwallet/unloadwallet
and running bitcoin-cli -getinfo
and bitcoin-cli -rpcwallet=<wallet-name> -getinfo
.
wallet_multiwallet.py --usecli
provides regression test coverage on this change, along with interface_bitcoin_cli.py
where this PR adds test coverage.
Credit to Wladimir J. van der Laan for the idea in #17314 and #18453 (comment).