@@ -164,23 +164,12 @@ CAmount CachedTxGetChange(const CWallet& wallet, const CWalletTx& wtx)
164164 return wtx.nChangeCached ;
165165}
166166
167- CAmount CachedTxGetImmatureCredit (const CWallet& wallet, const CWalletTx& wtx)
167+ CAmount CachedTxGetImmatureCredit (const CWallet& wallet, const CWalletTx& wtx, const isminefilter& filter )
168168{
169169 AssertLockHeld (wallet.cs_wallet );
170170
171171 if (wallet.IsTxImmatureCoinBase (wtx) && wallet.IsTxInMainChain (wtx)) {
172- return GetCachableAmount (wallet, wtx, CWalletTx::IMMATURE_CREDIT, ISMINE_SPENDABLE);
173- }
174-
175- return 0 ;
176- }
177-
178- CAmount CachedTxGetImmatureWatchOnlyCredit (const CWallet& wallet, const CWalletTx& wtx)
179- {
180- AssertLockHeld (wallet.cs_wallet );
181-
182- if (wallet.IsTxImmatureCoinBase (wtx) && wallet.IsTxInMainChain (wtx)) {
183- return GetCachableAmount (wallet, wtx, CWalletTx::IMMATURE_CREDIT, ISMINE_WATCH_ONLY);
172+ return GetCachableAmount (wallet, wtx, CWalletTx::IMMATURE_CREDIT, filter);
184173 }
185174
186175 return 0 ;
@@ -342,8 +331,8 @@ Balance GetBalance(const CWallet& wallet, const int min_depth, bool avoid_reuse)
342331 ret.m_mine_untrusted_pending += tx_credit_mine;
343332 ret.m_watchonly_untrusted_pending += tx_credit_watchonly;
344333 }
345- ret.m_mine_immature += CachedTxGetImmatureCredit (wallet, wtx);
346- ret.m_watchonly_immature += CachedTxGetImmatureWatchOnlyCredit (wallet, wtx);
334+ ret.m_mine_immature += CachedTxGetImmatureCredit (wallet, wtx, ISMINE_SPENDABLE );
335+ ret.m_watchonly_immature += CachedTxGetImmatureCredit (wallet, wtx, ISMINE_WATCH_ONLY );
347336 }
348337 }
349338 return ret;
0 commit comments