mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-15 16:38:23 +01:00
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: 39a7dbdd27
This commit is contained in:
@@ -1634,7 +1634,11 @@ bool CWallet::IsMine(const COutPoint& outpoint) const
|
|||||||
|
|
||||||
bool CWallet::IsFromMe(const CTransaction& tx) const
|
bool CWallet::IsFromMe(const CTransaction& tx) const
|
||||||
{
|
{
|
||||||
return (GetDebit(tx) > 0);
|
LOCK(cs_wallet);
|
||||||
|
for (const CTxIn& txin : tx.vin) {
|
||||||
|
if (GetTXO(txin.prevout)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAmount CWallet::GetDebit(const CTransaction& tx) const
|
CAmount CWallet::GetDebit(const CTransaction& tx) const
|
||||||
|
|||||||
Reference in New Issue
Block a user