diff options
author | ishaanam <ishaana.misra@gmail.com> | 2023-03-01 13:46:23 -0500 |
---|---|---|
committer | ishaanam <ishaana.misra@gmail.com> | 2024-03-15 18:03:42 -0400 |
commit | d64922b5903e5ffc8d2ce0e6761f99f173b60800 (patch) | |
tree | e1bb5c6bbbef6e04657dfe3d8833811ae50b7356 /src/wallet/receive.cpp | |
parent | ffe5ff1fb622a8da11b66289e1b778e45e449811 (diff) | |
download | bitcoin-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.cpp | 7 |
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; |