cli: display multiwallet total balance in -getinfo #19092

pull jonatack wants to merge 6 commits into bitcoin:master from jonatack:cli-getinfo-multiwallet-total-balance changing 4 files +55 −3
  1. jonatack commented at 4:45 pm on May 28, 2020: member

    Per review suggestion in #18594 (comment), this PR adds a total_balance field for -getinfo in multiwallet mode.

    0  "balances": {
    1    "": 0.00001000,
    2    "Encrypted": 0.00003500,
    3    "day-to-day": 0.00000120,
    4    "side project": 0.00000094
    5  },
    6  "total_balance": 0.00003714
    7}
    

    Updated help:

    0$ bitcoin-cli -h | grep -A3 getinfo
    1  -getinfo
    2       Get general information from the remote server, including the total
    3       balance and the balances of each loaded wallet when in
    4       multiwallet mode. Note that -getinfo is the combined result of
    5       several RPCs (getnetworkinfo, getblockchaininfo, getwalletinfo,
    6       getbalances, and in multiwallet mode, listwallets), each with
    7       potentially different state.
    

    Credit to João Barbosa for the suggestion.

  2. DrahtBot added the label Tests on May 28, 2020
  3. promag commented at 5:05 pm on May 28, 2020: member

    Concept ACK.

    Could update doc?

  4. jonatack commented at 7:09 pm on May 28, 2020: member
    Thanks @promag. Added a release note update.
  5. promag commented at 7:57 pm on May 28, 2020: member

    This is --help output

    0  -getinfo
    1       Get general information from the remote server. Note that unlike
    2       server-side RPC calls, the results of -getinfo is the result of
    3       multiple non-atomic requests. Some entries in the result may
    4       represent results from different states (e.g. wallet balance may
    5       be as of a different block from the chain state reported)
    

    nit, I wonder if this should document the result.

  6. DrahtBot commented at 9:13 pm on May 28, 2020: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #19089 (cli, test, doc: bitcoin-cli -getinfo multiwallet balances follow-ups by jonatack)
    • #16439 (cli/gui: support “@height” in place of blockhash for getblock on client side by ajtowns)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  7. fanquake deleted a comment on May 29, 2020
  8. jonatack commented at 10:59 am on May 30, 2020: member

    I wonder it this should document the result.

    Made an attempt at improving it.

  9. jonatack force-pushed on May 30, 2020
  10. vahidjalaliii commented at 12:40 pm on May 30, 2020: none
  11. luke-jr commented at 6:05 pm on June 3, 2020: member

    “balance” seems to perhaps oversimplify things…

    Maybe “total_balance”?

  12. Wiphawee112 commented at 7:34 am on June 4, 2020: none
    ฉันจะทราบได้อย่างไร่่่่ะว่ายอดเงินอยุ่ทึ่ใหน ช่วยแนะนำด้วยค่ะ
  13. jonatack commented at 7:57 am on June 4, 2020: member

    ฉันจะทราบได้อย่างไร่่่่ะว่ายอดเงินอยุ่ทึ่ใหน ช่วยแนะนำด้วยค่ะ

    “I can know exactly what the balance is. Please help.”

    I’ll take that as a Concept ACK :)

  14. jonatack commented at 8:00 am on June 4, 2020: member

    “balance” seems to perhaps oversimplify things…

    Maybe “total_balance”?

    That was my initial thought as well. @promag WDYT?

  15. promag commented at 8:13 am on June 4, 2020: member
    Also looks fine to me. I just mentioned balance to keep it backward compatible, but I guess that’s not a concern in -cli.
  16. jonatack force-pushed on Jun 4, 2020
  17. jonatack commented at 9:29 am on June 4, 2020: member
    Thanks @luke-jr and @promag, updated to total_balance displayed after the balances and improved the test coverage.
  18. jonatack force-pushed on Jun 5, 2020
  19. jonatack force-pushed on Jun 5, 2020
  20. jonatack force-pushed on Jun 6, 2020
  21. jonatack force-pushed on Jun 6, 2020
  22. in src/bitcoin-cli.cpp:529 in d1ae2e5827 outdated
    469+    bool sign{amount < 0};
    470+    int64_t n_abs{sign ? -amount : amount};
    471+    int64_t quotient{n_abs / COIN};
    472+    int64_t remainder{n_abs % COIN};
    473+    return UniValue(UniValue::VNUM, strprintf("%s%d.%08d", sign ? "-" : "", quotient, remainder));
    474+}
    


    luke-jr commented at 3:41 am on June 8, 2020:
    Can we get these into the libbitcoin_util.a module? I think this is the third copy…

    jonatack commented at 8:51 am on June 8, 2020:
    Yes, third one. Agreed, a good follow-up.

    promag commented at 9:25 am on June 8, 2020:
    Why not in this PR or in a base PR especially considering there aren’t ACKs.

    jonatack commented at 9:56 am on June 8, 2020:
    I think that refactoring would best be done in a separate PR.
  23. luke-jr referenced this in commit 53a343242e on Jun 9, 2020
  24. luke-jr referenced this in commit f07e8a5ac5 on Jun 9, 2020
  25. luke-jr referenced this in commit 08e745df22 on Jun 9, 2020
  26. luke-jr referenced this in commit b647930c73 on Jun 9, 2020
  27. luke-jr referenced this in commit c37ec2be63 on Jun 13, 2020
  28. luke-jr referenced this in commit 262acfb929 on Jun 13, 2020
  29. luke-jr referenced this in commit 71334e93d1 on Jun 13, 2020
  30. luke-jr referenced this in commit c8f691ff8f on Jun 13, 2020
  31. luke-jr referenced this in commit e9dab22190 on Jun 14, 2020
  32. luke-jr referenced this in commit 1f12eb1e8d on Jun 14, 2020
  33. luke-jr referenced this in commit 2292a4801d on Jun 14, 2020
  34. luke-jr referenced this in commit 28e479e43a on Jun 14, 2020
  35. DrahtBot added the label Needs rebase on Jun 16, 2020
  36. jonatack force-pushed on Jun 17, 2020
  37. DrahtBot removed the label Needs rebase on Jun 17, 2020
  38. DrahtBot added the label Needs rebase on Jun 21, 2020
  39. cli: add AmountFromValue() and ValueFromAmount() bbf0afade8
  40. cli: add -getinfo multiwallet total balance 8e6c8d69f9
  41. test: add `assert_scale` assertion to test framework fbccd3919f
  42. test: add coverage for -getinfo total_balance 414804e877
  43. doc: release note for -getinfo total_balance 3b2ab9d939
  44. cli, doc: update bitcoin-cli -getinfo help 08ac1abc58
  45. jonatack force-pushed on Jun 21, 2020
  46. DrahtBot removed the label Needs rebase on Jun 21, 2020
  47. jonatack commented at 5:45 pm on June 22, 2020: member
    Closing, there are many open PRs and this has no ACKs. At least this PR was pulled into other Bitcoin implementations, so it will be useful for those users.
  48. jonatack closed this on Jun 22, 2020

  49. luke-jr referenced this in commit 403507dfcf on Dec 9, 2020
  50. luke-jr referenced this in commit cd87fecdad on Dec 9, 2020
  51. luke-jr referenced this in commit edda2fb6d8 on Dec 9, 2020
  52. luke-jr referenced this in commit ba0e0082ad on Dec 9, 2020
  53. luke-jr referenced this in commit e441262f7f on Oct 10, 2021
  54. luke-jr referenced this in commit f8b6226426 on Oct 10, 2021
  55. luke-jr referenced this in commit 77b32712c0 on Oct 10, 2021
  56. luke-jr referenced this in commit fcb25e9192 on Oct 10, 2021
  57. luke-jr referenced this in commit cc46c0a596 on Oct 19, 2021
  58. luke-jr referenced this in commit e46553fc2b on Oct 19, 2021
  59. luke-jr referenced this in commit e612cd8c53 on Oct 19, 2021
  60. luke-jr referenced this in commit e8bab0a407 on Oct 19, 2021
  61. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-23 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me