From d7cf640bbf1faa709d788c3b237f5ce679de6ba3 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 30 Jul 2018 17:09:13 -0700 Subject: [PATCH] Create CWallet::IsSaplingNullifierFromMe() --- src/wallet/wallet.cpp | 17 +++++++++++++++++ src/wallet/wallet.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index a6b55f106..36595a907 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1566,6 +1566,18 @@ bool CWallet::IsSproutNullifierFromMe(const uint256& nullifier) const return false; } +bool CWallet::IsSaplingNullifierFromMe(const uint256& nullifier) const +{ + { + LOCK(cs_wallet); + if (mapSaplingNullifiersToNotes.count(nullifier) && + mapWallet.count(mapSaplingNullifiersToNotes.at(nullifier).hash)) { + return true; + } + } + return false; +} + void CWallet::GetSproutNoteWitnesses(std::vector notes, std::vector>& witnesses, uint256 &final_anchor) @@ -1712,6 +1724,11 @@ bool CWallet::IsFromMe(const CTransaction& tx) const } } } + for (const SpendDescription &spend : tx.vShieldedSpend) { + if (IsSaplingNullifierFromMe(spend.nullifier)) { + return true; + } + } return false; } diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index aec720073..d020357a2 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1099,6 +1099,8 @@ public: mapSproutNoteData_t FindMySproutNotes(const CTransaction& tx) const; mapSaplingNoteData_t FindMySaplingNotes(const CTransaction& tx) const; bool IsSproutNullifierFromMe(const uint256& nullifier) const; + bool IsSaplingNullifierFromMe(const uint256& nullifier) const; + void GetSproutNoteWitnesses( std::vector notes, std::vector>& witnesses,