302@@ -303,18 +303,23 @@ Balance GetBalance(const CWallet& wallet, const int min_depth, bool avoid_reuse)
303 const bool is_trusted{CachedTxIsTrusted(wallet, wtx, trusted_parents)};
304 const int tx_depth{wallet.GetTxDepthInMainChain(wtx)};
305 const CAmount tx_credit_mine{CachedTxGetAvailableCredit(wallet, wtx, ISMINE_SPENDABLE | reuse_filter)};
306+ const CAmount tx_credit_mine_used{
307+ avoid_reuse ? CachedTxGetAvailableCredit(wallet, wtx, ISMINE_SPENDABLE | ISMINE_USED) : tx_credit_mine};
What about caculating
avoid_reuse
locally (e.g.
const bool avoid = !(m_wallet->IsWalletFlagSet(WALLET_FLAG_AVOID_REUSE));
at the beginning of the function), instead of passing it? I thought
@achow101’s
comment was referring to include that too but maybe I’m wrong.
have it always compute the used balance for us rather than having the caller do this extra computation.
My understanding of this part of @achow101 comment was to move the calculation for the used
balance to GetBalance(...)
I have updated the PR and added GetFullBalance()
which adds used
balance to GetBalance(...)