wallet: clean InputIsMine code, use GetWalletTx

This commit is contained in:
furszy committed 2022-07-05 10:10:33 -03:00
1 parent 0cb177263c
commit bf310b0e8c
1 file changed
+4 -7
+4 -7
View File
@@ -9,15 +9,12 @@
#include <wallet/wallet.h>
namespace wallet {
isminetype InputIsMine(const CWallet& wallet, const CTxIn &txin)
isminetype InputIsMine(const CWallet& wallet, const CTxIn& txin)
{
AssertLockHeld(wallet.cs_wallet);
std::map<uint256, CWalletTx>::const_iterator mi = wallet.mapWallet.find(txin.prevout.hash);
if (mi != wallet.mapWallet.end())
{
const CWalletTx& prev = (*mi).second;
if (txin.prevout.n < prev.tx->vout.size())
return wallet.IsMine(prev.tx->vout[txin.prevout.n]);
const CWalletTx* prev = wallet.GetWalletTx(txin.prevout.hash);
if (prev && txin.prevout.n < prev->tx->vout.size()) {
return wallet.IsMine(prev->tx->vout[txin.prevout.n]);
}
return ISMINE_NO;
}