@@ -2420,10 +2420,11 @@ CWallet::Balance CWallet::GetBalance(const int min_depth, bool avoid_reuse) cons
2420
2420
{
2421
2421
auto locked_chain = chain ().lock ();
2422
2422
LOCK (cs_wallet);
2423
+ std::set<uint256> trustedParents;
2423
2424
for (const auto & entry : mapWallet)
2424
2425
{
2425
2426
const CWalletTx& wtx = entry.second ;
2426
- const bool is_trusted{wtx.IsTrusted (*locked_chain)};
2427
+ const bool is_trusted{wtx.IsTrusted (*locked_chain, trustedParents )};
2427
2428
const int tx_depth{wtx.GetDepthInMainChain (*locked_chain)};
2428
2429
const CAmount tx_credit_mine{wtx.GetAvailableCredit (*locked_chain, /* fUseCache */ true , ISMINE_SPENDABLE | reuse_filter)};
2429
2430
const CAmount tx_credit_watchonly{wtx.GetAvailableCredit (*locked_chain, /* fUseCache */ true , ISMINE_WATCH_ONLY | reuse_filter)};
@@ -2470,6 +2471,7 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
2470
2471
const int min_depth = {coinControl ? coinControl->m_min_depth : DEFAULT_MIN_DEPTH};
2471
2472
const int max_depth = {coinControl ? coinControl->m_max_depth : DEFAULT_MAX_DEPTH};
2472
2473
2474
+ std::set<uint256> trustedParents;
2473
2475
for (const auto & entry : mapWallet)
2474
2476
{
2475
2477
const uint256& wtxid = entry.first ;
@@ -2491,7 +2493,7 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
2491
2493
if (nDepth == 0 && !wtx.InMempool ())
2492
2494
continue ;
2493
2495
2494
- bool safeTx = wtx.IsTrusted (locked_chain);
2496
+ bool safeTx = wtx.IsTrusted (locked_chain, trustedParents );
2495
2497
2496
2498
// We should not consider coins from transactions that are replacing
2497
2499
// other transactions.
@@ -3776,11 +3778,12 @@ std::map<CTxDestination, CAmount> CWallet::GetAddressBalances(interfaces::Chain:
3776
3778
3777
3779
{
3778
3780
LOCK (cs_wallet);
3781
+ std::set<uint256> trustedParents;
3779
3782
for (const auto & walletEntry : mapWallet)
3780
3783
{
3781
3784
const CWalletTx& wtx = walletEntry.second ;
3782
3785
3783
- if (!wtx.IsTrusted (locked_chain))
3786
+ if (!wtx.IsTrusted (locked_chain, trustedParents ))
3784
3787
continue ;
3785
3788
3786
3789
if (wtx.IsImmatureCoinBase (locked_chain))
0 commit comments