|
|
|
@ -186,7 +186,7 @@ CAmount CachedTxGetImmatureWatchOnlyCredit(const CWallet& wallet, const CWalletT
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CAmount CachedTxGetAvailableCredit(const CWallet& wallet, const CWalletTx& wtx, bool fUseCache, const isminefilter& filter)
|
|
|
|
|
CAmount CachedTxGetAvailableCredit(const CWallet& wallet, const CWalletTx& wtx, const isminefilter& filter)
|
|
|
|
|
{
|
|
|
|
|
AssertLockHeld(wallet.cs_wallet);
|
|
|
|
|
|
|
|
|
@ -197,7 +197,7 @@ CAmount CachedTxGetAvailableCredit(const CWallet& wallet, const CWalletTx& wtx,
|
|
|
|
|
if (wallet.IsTxImmatureCoinBase(wtx))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (fUseCache && allow_cache && wtx.m_amounts[CWalletTx::AVAILABLE_CREDIT].m_cached[filter]) {
|
|
|
|
|
if (allow_cache && wtx.m_amounts[CWalletTx::AVAILABLE_CREDIT].m_cached[filter]) {
|
|
|
|
|
return wtx.m_amounts[CWalletTx::AVAILABLE_CREDIT].m_value[filter];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -332,8 +332,8 @@ Balance GetBalance(const CWallet& wallet, const int min_depth, bool avoid_reuse)
|
|
|
|
|
const CWalletTx& wtx = entry.second;
|
|
|
|
|
const bool is_trusted{CachedTxIsTrusted(wallet, wtx, trusted_parents)};
|
|
|
|
|
const int tx_depth{wallet.GetTxDepthInMainChain(wtx)};
|
|
|
|
|
const CAmount tx_credit_mine{CachedTxGetAvailableCredit(wallet, wtx, /*fUseCache=*/true, ISMINE_SPENDABLE | reuse_filter)};
|
|
|
|
|
const CAmount tx_credit_watchonly{CachedTxGetAvailableCredit(wallet, wtx, /*fUseCache=*/true, ISMINE_WATCH_ONLY | reuse_filter)};
|
|
|
|
|
const CAmount tx_credit_mine{CachedTxGetAvailableCredit(wallet, wtx, ISMINE_SPENDABLE | reuse_filter)};
|
|
|
|
|
const CAmount tx_credit_watchonly{CachedTxGetAvailableCredit(wallet, wtx, ISMINE_WATCH_ONLY | reuse_filter)};
|
|
|
|
|
if (is_trusted && tx_depth >= min_depth) {
|
|
|
|
|
ret.m_mine_trusted += tx_credit_mine;
|
|
|
|
|
ret.m_watchonly_trusted += tx_credit_watchonly;
|
|
|
|
|