Skip to content

Commit 47ea70f

Browse files
committed
wallet: clean AllInputsMine code, use InputIsMine internally
Instead of duplicate the exact same code twice.
1 parent bf310b0 commit 47ea70f

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/wallet/receive.cpp

+2-14
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,8 @@ isminetype InputIsMine(const CWallet& wallet, const CTxIn& txin)
2222
bool AllInputsMine(const CWallet& wallet, const CTransaction& tx, const isminefilter& filter)
2323
{
2424
LOCK(wallet.cs_wallet);
25-
26-
for (const CTxIn& txin : tx.vin)
27-
{
28-
auto mi = wallet.mapWallet.find(txin.prevout.hash);
29-
if (mi == wallet.mapWallet.end())
30-
return false; // any unknown inputs can't be from us
31-
32-
const CWalletTx& prev = (*mi).second;
33-
34-
if (txin.prevout.n >= prev.tx->vout.size())
35-
return false; // invalid input!
36-
37-
if (!(wallet.IsMine(prev.tx->vout[txin.prevout.n]) & filter))
38-
return false;
25+
for (const CTxIn& txin : tx.vin) {
26+
if (!(InputIsMine(wallet, txin) & filter)) return false;
3927
}
4028
return true;
4129
}

0 commit comments

Comments
 (0)