mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
wallet: Add CWallet::IsMine(COutPoint)
It is useful to have an IsMine function that can take an outpoint.
This commit is contained in:
parent
64f7a1940d
commit
f2d00bfe1a
2 changed files with 14 additions and 0 deletions
|
@ -1421,6 +1421,19 @@ bool CWallet::IsMine(const CTransaction& tx) const
|
|||
return false;
|
||||
}
|
||||
|
||||
isminetype CWallet::IsMine(const COutPoint& outpoint) const
|
||||
{
|
||||
AssertLockHeld(cs_wallet);
|
||||
auto wtx = GetWalletTx(outpoint.hash);
|
||||
if (!wtx) {
|
||||
return ISMINE_NO;
|
||||
}
|
||||
if (outpoint.n >= wtx->tx->vout.size()) {
|
||||
return ISMINE_NO;
|
||||
}
|
||||
return IsMine(wtx->tx->vout[outpoint.n]);
|
||||
}
|
||||
|
||||
bool CWallet::IsFromMe(const CTransaction& tx) const
|
||||
{
|
||||
return (GetDebit(tx, ISMINE_ALL) > 0);
|
||||
|
|
|
@ -684,6 +684,7 @@ public:
|
|||
CAmount GetDebit(const CTxIn& txin, const isminefilter& filter) const;
|
||||
isminetype IsMine(const CTxOut& txout) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
bool IsMine(const CTransaction& tx) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
isminetype IsMine(const COutPoint& outpoint) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
/** should probably be renamed to IsRelevantToMe */
|
||||
bool IsFromMe(const CTransaction& tx) const;
|
||||
CAmount GetDebit(const CTransaction& tx, const isminefilter& filter) const;
|
||||
|
|
Loading…
Add table
Reference in a new issue