diff options
author | Andrew Chow <achow101-github@achow101.com> | 2022-07-22 14:49:10 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2022-08-16 20:17:01 -0400 |
commit | f2d00bfe1a32a11c0d88e8c1d3bae6a6b01db15e (patch) | |
tree | 802cb1ae3b8380550979141581109a0f7a35847b /src/wallet/wallet.cpp | |
parent | 64f7a1940d738a9acd207883af1dfda3e00f4a21 (diff) | |
download | bitcoin-f2d00bfe1a32a11c0d88e8c1d3bae6a6b01db15e.tar.xz |
wallet: Add CWallet::IsMine(COutPoint)
It is useful to have an IsMine function that can take an outpoint.
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r-- | src/wallet/wallet.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 45f49954a3..02fe6fba5b 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -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); |