aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/receive.cpp
diff options
context:
space:
mode:
authorfurszy <matiasfurszyfer@protonmail.com>2022-07-04 19:47:05 -0300
committerfurszy <matiasfurszyfer@protonmail.com>2022-07-05 10:10:27 -0300
commit0cb177263c36118094b7cd3b8f94741c0471ff62 (patch)
treed0fc35e0d60bce5717c763be3d9a87dbdc28f1bb /src/wallet/receive.cpp
parent04c6423f7b250ae1e51bb5cd159913e97494fb0e (diff)
wallet: unify CachedTxGetImmatureCredit and CachedTxGetImmatureWatchOnlyCredit
Diffstat (limited to 'src/wallet/receive.cpp')
-rw-r--r--src/wallet/receive.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/wallet/receive.cpp b/src/wallet/receive.cpp
index 243c5908ea..ec990339a3 100644
--- a/src/wallet/receive.cpp
+++ b/src/wallet/receive.cpp
@@ -164,23 +164,12 @@ CAmount CachedTxGetChange(const CWallet& wallet, const CWalletTx& wtx)
return wtx.nChangeCached;
}
-CAmount CachedTxGetImmatureCredit(const CWallet& wallet, const CWalletTx& wtx)
+CAmount CachedTxGetImmatureCredit(const CWallet& wallet, const CWalletTx& wtx, const isminefilter& filter)
{
AssertLockHeld(wallet.cs_wallet);
if (wallet.IsTxImmatureCoinBase(wtx) && wallet.IsTxInMainChain(wtx)) {
- return GetCachableAmount(wallet, wtx, CWalletTx::IMMATURE_CREDIT, ISMINE_SPENDABLE);
- }
-
- return 0;
-}
-
-CAmount CachedTxGetImmatureWatchOnlyCredit(const CWallet& wallet, const CWalletTx& wtx)
-{
- AssertLockHeld(wallet.cs_wallet);
-
- if (wallet.IsTxImmatureCoinBase(wtx) && wallet.IsTxInMainChain(wtx)) {
- return GetCachableAmount(wallet, wtx, CWalletTx::IMMATURE_CREDIT, ISMINE_WATCH_ONLY);
+ return GetCachableAmount(wallet, wtx, CWalletTx::IMMATURE_CREDIT, filter);
}
return 0;
@@ -342,8 +331,8 @@ Balance GetBalance(const CWallet& wallet, const int min_depth, bool avoid_reuse)
ret.m_mine_untrusted_pending += tx_credit_mine;
ret.m_watchonly_untrusted_pending += tx_credit_watchonly;
}
- ret.m_mine_immature += CachedTxGetImmatureCredit(wallet, wtx);
- ret.m_watchonly_immature += CachedTxGetImmatureWatchOnlyCredit(wallet, wtx);
+ ret.m_mine_immature += CachedTxGetImmatureCredit(wallet, wtx, ISMINE_SPENDABLE);
+ ret.m_watchonly_immature += CachedTxGetImmatureCredit(wallet, wtx, ISMINE_WATCH_ONLY);
}
}
return ret;