aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/coinselection.h
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-07-21 14:15:03 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-07-21 14:15:18 +0200
commitcac38cdd02e0086824d40f1260a6c0597ad7eafd (patch)
tree9caa21bc09632e7bf186880f0300e34f7db92856 /src/wallet/coinselection.h
parent1c046bb7ac0261d1d8f231ae1d8b39551ee60955 (diff)
parenta37e29d32fde8c7b4143322deeef2a8a06114d43 (diff)
Merge bitcoin/bitcoin#21832: cli: Improve -getinfo return format
a37e29d32fde8c7b4143322deeef2a8a06114d43 cli: Implement human readable -getinfo. (Klement Tan) Pull request description: # Overview **Description** This PR changes the return format of `-getinfo` **Rationale** - make `-getinfo` more user-friendly - uses less vertical screen space. Fixes: Issue 17314(Not linking issue to prevent it from closing) > Alternative, more human-friendly, format besides JSON? Colors, progress bars ### Return Format ```bash // Data from getblockchaininfo Chain: [getblockchaininfo.chain] Blocks: [getblockchaininfo.blocks] Headers: [getblockchaininfo.headers] Verification progress: [getblockchaininfo.verificationprogress] Difficulty: [getblockchaininfo.difficulty] # Data from getnetworkinfo Network: in [getnetworkinfo.connections_in], out [getnetworkinfo.connections_out], total [getnetworkinfo.connections] Version: [getnetworkinfo.version] Time offset (s): [getnetworkinfo.timeoffset] Proxy: [getnetworkinfo.proxy] // "N/A" if no proxy Min tx relay fee rate (BTC/kvB): [getnetworkinfo.relayfee] # Data from getwalletinfo. Will only be present when a single wallet is loaded Wallet: [getnetworkinfo.walletname] // "" if walletname is empty(default wallet) Keypool size: [getnetworkinfo.keypoolsize] Unlocked until: [getnetworkinfo.unlocked_until] Transaction fee rate (-paytxfee) (BTC/kvB): [getnetworkinfo.paytxfee] # Data from getbalances. Will only be present when a single wallet is loaded Balance: [getbalances.mine.trusted] # Data from listwallets then getbalances for each wallet. Will only be present for multiple wallets loaded Balances [getbalances.mine.trusted] [listwallets[i]] // Right justify on balance Warnings: [getnetworkinfo.warnings] ``` #### Coloring The following lines would be colored to better show the differences between the various `-getinfo` components. However, this will not apply for `WIN32`(ANSI code not supported) and users that connect the `stdout` to a non-terminal process. - `Chain: ...`: BLUE(`\x1B[34m`) - `Network: ...`: GREEN(`\x1B[32m`) - `Wallet: ...`: MAGENTA(`\x1B[35m`) - `Balance: ...` CYAN(`\x1B[36m`) - `Balances: ...` CYAN(`\x1B[36m`) - `Warnings: ...` Yellow(`\x1B[33m`) ### Screenshots *No wallet loaded:* ![image](https://user-images.githubusercontent.com/49265907/121794631-94b62080-cc3c-11eb-8627-d0d1c25f0878.png) *Single wallet loaded* ![image](https://user-images.githubusercontent.com/49265907/121794619-6df7ea00-cc3c-11eb-8420-d0c18236b188.png) *Multi wallet loaded* ![image](https://user-images.githubusercontent.com/49265907/121794626-810aba00-cc3c-11eb-8cd7-c15ede1918ac.png) # Reviewing Notes ## Testing Scenarios **1. No wallet loaded** - When there no wallets are loaded(Unload wallet with `./src/bitcoin-cli unloadwallet "YOUR_WALLETNAME"` - Test with `./src/bitcoin-cli -getinfo`. - Should only display `chain` and `network` segment **2. Single wallet loaded** - When only a single wallet loaded or `-rpcwallet` is set(Load wallet with `./src/bitcoin-cli loadwallet "YOUR_WALLETNAME"`) - Test with `./src/bitcoin-cli -rpcwallet="YOUR_WALLETNAME" -getinfo`(Load wallet with `./src/bitcoin-cli loadwallet "YOUR_WALLETNAME"`) - Should only display `chain`, `network`, `wallet` and `balance` segment **3. Multiple wallet loaded** - When there are multiple wallets loaded(Load wallet with `./src/bitcoin-cli loadwallet "YOUR_WALLETNAME"`) - Test with `./src/bitcoin-cli -getinfo` - Should only display `chain`, `network` and `balances` segment ## Implementation **Current Flow** 1. `GetinfoRequestHandler` is instantiated 2. `ConnectAndCallRPC` is called with `GetinfoRequestHandler`. It returns `UniValue::VOBJ result` 3. If `-rpcwallet` wallet is not set, `GetWalletBalances` is called with a pointer to `result` as a parameter. It adds the balances for all the wallets to `result` **New Flow** 1. `GetinfoRequestHandler` is instantiated 2. `ConnectAndCallRPC` is called with `GetinfoRequestHandler`. It returns `UniValue::VOBJ result` 3. If `-rpcwallet` wallet is not set, `GetWalletBalances` is called with a pointer to `result` as a parameter. It adds the balances for all the wallets to `result` 4. **New** `ParseGetInfoResult` is called with `result` as parameter. It converts results type from `UniValue::VOBJ` to `UniValue::VSTR` according to the format stated above. ACKs for top commit: theStack: re-ACK a37e29d32fde8c7b4143322deeef2a8a06114d43 Tree-SHA512: 5e90606a397abfc4e5921f6db70a0a4888cbebba9da9b70cfe72d593caf669fd090de3e58eecf1cb5c20d5f448ad278999165d32d01667037d09bd352d23ac5d
Diffstat (limited to 'src/wallet/coinselection.h')
0 files changed, 0 insertions, 0 deletions