From bab1ac827b4fdd4984661f32f6b899d56261da5d Mon Sep 17 00:00:00 2001 From: Ava Chow Date: Thu, 28 Aug 2025 13:39:46 -0700 Subject: [PATCH] wallet: Determine IsFromMe by checking for TXOs of inputs Instead of checking whether the total amount of inputs known by the wallet is greater than 0, we should be checking for whether the input is known by the wallet. This enables us to determine whether a transaction spends an of output with an amount of 0, which is necessary for marking 0-value dust outputs as spent. Github-Pull: #33268 Rebased-From: 39a7dbdd277d1dea9a70314d8cc5ae057999ee88 --- src/wallet/wallet.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 2397d84a6f5..913c7453205 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1702,7 +1702,13 @@ isminetype CWallet::IsMine(const COutPoint& outpoint) const bool CWallet::IsFromMe(const CTransaction& tx) const { - return (GetDebit(tx, ISMINE_ALL) > 0); + LOCK(cs_wallet); + for (const CTxIn& txin : tx.vin) { + if (IsMine(txin.prevout)) { + return true; + } + } + return false; } CAmount CWallet::GetDebit(const CTransaction& tx, const isminefilter& filter) const