0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-13 11:25:02 -05:00

wallet: clean InputIsMine code, use GetWalletTx

This commit is contained in:
furszy 2022-07-04 19:53:04 -03:00
parent 0cb177263c
commit bf310b0e8c
No known key found for this signature in database
GPG key ID: 5DD23CCC686AA623

View file

@ -9,15 +9,12 @@
#include <wallet/wallet.h> #include <wallet/wallet.h>
namespace wallet { namespace wallet {
isminetype InputIsMine(const CWallet& wallet, const CTxIn &txin) isminetype InputIsMine(const CWallet& wallet, const CTxIn& txin)
{ {
AssertLockHeld(wallet.cs_wallet); AssertLockHeld(wallet.cs_wallet);
std::map<uint256, CWalletTx>::const_iterator mi = wallet.mapWallet.find(txin.prevout.hash); const CWalletTx* prev = wallet.GetWalletTx(txin.prevout.hash);
if (mi != wallet.mapWallet.end()) if (prev && txin.prevout.n < prev->tx->vout.size()) {
{ return wallet.IsMine(prev->tx->vout[txin.prevout.n]);
const CWalletTx& prev = (*mi).second;
if (txin.prevout.n < prev.tx->vout.size())
return wallet.IsMine(prev.tx->vout[txin.prevout.n]);
} }
return ISMINE_NO; return ISMINE_NO;
} }