aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/receive.cpp
diff options
context:
space:
mode:
authorishaanam <ishaana.misra@gmail.com>2023-03-01 13:46:23 -0500
committerishaanam <ishaana.misra@gmail.com>2024-03-15 18:03:42 -0400
commitd64922b5903e5ffc8d2ce0e6761f99f173b60800 (patch)
treee1bb5c6bbbef6e04657dfe3d8833811ae50b7356 /src/wallet/receive.cpp
parentffe5ff1fb622a8da11b66289e1b778e45e449811 (diff)
downloadbitcoin-d64922b5903e5ffc8d2ce0e6761f99f173b60800.tar.xz
wallet refactor: use CWalletTx member functions to determine tx state
Diffstat (limited to 'src/wallet/receive.cpp')
-rw-r--r--src/wallet/receive.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/wallet/receive.cpp b/src/wallet/receive.cpp
index b9d8d9abc9..ea3ffff549 100644
--- a/src/wallet/receive.cpp
+++ b/src/wallet/receive.cpp
@@ -149,7 +149,7 @@ CAmount CachedTxGetImmatureCredit(const CWallet& wallet, const CWalletTx& wtx, c
{
AssertLockHeld(wallet.cs_wallet);
- if (wallet.IsTxImmatureCoinBase(wtx) && wallet.IsTxInMainChain(wtx)) {
+ if (wallet.IsTxImmatureCoinBase(wtx) && wtx.isConfirmed()) {
return GetCachableAmount(wallet, wtx, CWalletTx::IMMATURE_CREDIT, filter);
}
@@ -256,9 +256,8 @@ bool CachedTxIsFromMe(const CWallet& wallet, const CWalletTx& wtx, const isminef
bool CachedTxIsTrusted(const CWallet& wallet, const CWalletTx& wtx, std::set<uint256>& trusted_parents)
{
AssertLockHeld(wallet.cs_wallet);
- int nDepth = wallet.GetTxDepthInMainChain(wtx);
- if (nDepth >= 1) return true;
- if (nDepth < 0) return false;
+ if (wtx.isConfirmed()) return true;
+ if (wtx.isBlockConflicted()) return false;
// using wtx's cached debit
if (!wallet.m_spend_zero_conf_change || !CachedTxIsFromMe(wallet, wtx, ISMINE_ALL)) return false;