Wallet: Functions to enable adding used balance to GUI overview page #28776

pull BrandonOdiwuor wants to merge 1 commits into bitcoin:master from BrandonOdiwuor:gui_overview_page_add_used_balance changing 2 files +11 −1
  1. BrandonOdiwuor commented at 3:23 pm on November 2, 2023: contributor

    First Part: Fixes https://github.com/bitcoin-core/gui/issues/769

    Functions to enable adding used balance to the overview page for wallets with the avoid_reuse flag

    Dependency

    Screenshot from 2023-11-02 18-10-06

  2. Add used balance for avoid_resuse wallets to wallet interface 5155b526da
  3. DrahtBot commented at 3:23 pm on November 2, 2023: contributor

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

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK katesalazar, pablomartin4btc

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    Conflicts

    No conflicts as of last run.

  4. DrahtBot added the label Wallet on Nov 2, 2023
  5. katesalazar commented at 6:51 pm on November 6, 2023: contributor
    Concept ACK
  6. bitcoin deleted a comment on Nov 7, 2023
  7. in src/wallet/interfaces.cpp:414 in 5155b526da
    409@@ -410,6 +410,11 @@ class WalletImpl : public Wallet
    410             result.unconfirmed_watch_only_balance = bal.m_watchonly_untrusted_pending;
    411             result.immature_watch_only_balance = bal.m_watchonly_immature;
    412         }
    413+        if (m_wallet->IsWalletFlagSet(WALLET_FLAG_AVOID_REUSE)) {
    414+            const auto full_bal = GetBalance(*m_wallet, 0, false);
    


    pablomartin4btc commented at 10:42 pm on November 22, 2023:

    GetBalance receives bool avoid_reuse in the last argument, should not be true or just remove the if condition directly and pass the result of IsWalletFlagSet(WALLET_FLAG_AVOID_REUSE) entirely.

    0            const auto full_bal = GetBalance(*m_wallet, 0, true);
    

    achow101 commented at 2:39 pm on November 28, 2023:

    That parameter is slightly misleading. When set to true, it will ignore the used balance, so it needs to be false here in order to get the full balance to calculate the used balance. This is what getbalances does.

    However, I think it would be better to move all of this into GetBalance itself and just have it always compute the used balance for us rather than having the caller do this extra computation.


    pablomartin4btc commented at 4:16 pm on November 28, 2023:

    Sorry, it’s clear, I was incorrect in my statement, but what I meant is we could use the flag instead of false (e.g.: GetBalance(*m_wallet, 0, !(m_wallet->IsWalletFlagSet(WALLET_FLAG_AVOID_REUSE)));) and remove the if.

    I agree with moving this piece into GetBalance, the other only place where this is called with this argument is in coins.cpp.

  8. pablomartin4btc commented at 10:43 pm on November 22, 2023: member

    Concept ACK

    Light CR, left a suggestion if I understand it correctly.

    Also, since this is a very small change on the wallet interface, perhaps makes more sense to add this commit first on the GUI PR #775 and would be easier to test the gui as well.

  9. DrahtBot added the label CI failed on Jan 16, 2024
  10. in src/interfaces/wallet.h:284 in 5155b526da
    279@@ -280,6 +280,9 @@ class Wallet
    280     //! Return whether is a legacy wallet
    281     virtual bool isLegacy() = 0;
    282 
    283+    //Return whether wallet has 'avoid_reuse' flag set
    284+    virtual bool isAvoidReuseEnabled() = 0;
    


    maflcko commented at 2:58 pm on April 9, 2024:
    Interface functions that are newly introduced or are only called by the GUI can be handled in the GUI repo. Closing for now, this can be moved into the GUI pull.
  11. maflcko closed this on Apr 9, 2024


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-11-21 12:12 UTC

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