aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/receive.cpp
diff options
context:
space:
mode:
authorfurszy <matiasfurszyfer@protonmail.com>2022-07-04 19:57:04 -0300
committerfurszy <matiasfurszyfer@protonmail.com>2022-07-06 18:04:19 -0300
commit47ea70fbb85fefeb4de9d3142a11596d292eab9b (patch)
tree0625ed6ead60df353cfca72a103cd321a259027a /src/wallet/receive.cpp
parentbf310b0e8ce82d52bacceeb47c9f5dbb26885f7e (diff)
downloadbitcoin-47ea70fbb85fefeb4de9d3142a11596d292eab9b.tar.xz
wallet: clean AllInputsMine code, use InputIsMine internally
Instead of duplicate the exact same code twice.
Diffstat (limited to 'src/wallet/receive.cpp')
-rw-r--r--src/wallet/receive.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/wallet/receive.cpp b/src/wallet/receive.cpp
index 1f76704b93..e0b2264b13 100644
--- a/src/wallet/receive.cpp
+++ b/src/wallet/receive.cpp
@@ -22,20 +22,8 @@ isminetype InputIsMine(const CWallet& wallet, const CTxIn& txin)
bool AllInputsMine(const CWallet& wallet, const CTransaction& tx, const isminefilter& filter)
{
LOCK(wallet.cs_wallet);
-
- for (const CTxIn& txin : tx.vin)
- {
- auto mi = wallet.mapWallet.find(txin.prevout.hash);
- if (mi == wallet.mapWallet.end())
- return false; // any unknown inputs can't be from us
-
- const CWalletTx& prev = (*mi).second;
-
- if (txin.prevout.n >= prev.tx->vout.size())
- return false; // invalid input!
-
- if (!(wallet.IsMine(prev.tx->vout[txin.prevout.n]) & filter))
- return false;
+ for (const CTxIn& txin : tx.vin) {
+ if (!(InputIsMine(wallet, txin) & filter)) return false;
}
return true;
}