Skip to content

Commit

Permalink
Create CWallet::IsSaplingNullifierFromMe()
Browse files Browse the repository at this point in the history
  • Loading branch information
bitcartel committed Aug 8, 2018
1 parent 037cacf commit d7cf640
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/wallet/wallet.cpp
Expand Up @@ -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<JSOutPoint> notes,
std::vector<boost::optional<SproutWitness>>& witnesses,
uint256 &final_anchor)
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions src/wallet/wallet.h
Expand Up @@ -1099,6 +1099,8 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
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<JSOutPoint> notes,
std::vector<boost::optional<SproutWitness>>& witnesses,
Expand Down

0 comments on commit d7cf640

Please sign in to comment.