Skip to content

Commit b1c693e

Browse files
committed
Add methods to store SaplingOutPoint in setLockedSaplingNotes
1 parent 0f62cac commit b1c693e

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

src/wallet/wallet.cpp

+31
Original file line numberDiff line numberDiff line change
@@ -3858,6 +3858,37 @@ std::vector<JSOutPoint> CWallet::ListLockedSproutNotes()
38583858
return vOutpts;
38593859
}
38603860

3861+
void CWallet::LockNote(const SaplingOutPoint& output)
3862+
{
3863+
AssertLockHeld(cs_wallet);
3864+
setLockedSaplingNotes.insert(output);
3865+
}
3866+
3867+
void CWallet::UnlockNote(const SaplingOutPoint& output)
3868+
{
3869+
AssertLockHeld(cs_wallet);
3870+
setLockedSaplingNotes.erase(output);
3871+
}
3872+
3873+
void CWallet::UnlockAllSaplingNotes()
3874+
{
3875+
AssertLockHeld(cs_wallet);
3876+
setLockedSaplingNotes.clear();
3877+
}
3878+
3879+
bool CWallet::IsLockedNote(const SaplingOutPoint& output) const
3880+
{
3881+
AssertLockHeld(cs_wallet);
3882+
return (setLockedSaplingNotes.count(output) > 0);
3883+
}
3884+
3885+
std::vector<SaplingOutPoint> CWallet::ListLockedSaplingNotes()
3886+
{
3887+
AssertLockHeld(cs_wallet);
3888+
std::vector<SaplingOutPoint> vOutputs(setLockedSaplingNotes.begin(), setLockedSaplingNotes.end());
3889+
return vOutputs;
3890+
}
3891+
38613892
/** @} */ // end of Actions
38623893

38633894
class CAffectedKeysVisitor : public boost::static_visitor<void> {

src/wallet/wallet.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
942942

943943
std::set<COutPoint> setLockedCoins;
944944
std::set<JSOutPoint> setLockedSproutNotes;
945+
std::set<SaplingOutPoint> setLockedSaplingNotes;
945946

946947
int64_t nTimeFirstKey;
947948

@@ -963,13 +964,17 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
963964
void UnlockAllCoins();
964965
void ListLockedCoins(std::vector<COutPoint>& vOutpts);
965966

966-
967967
bool IsLockedNote(const JSOutPoint& outpt) const;
968968
void LockNote(const JSOutPoint& output);
969969
void UnlockNote(const JSOutPoint& output);
970970
void UnlockAllSproutNotes();
971971
std::vector<JSOutPoint> ListLockedSproutNotes();
972972

973+
bool IsLockedNote(const SaplingOutPoint& output) const;
974+
void LockNote(const SaplingOutPoint& output);
975+
void UnlockNote(const SaplingOutPoint& output);
976+
void UnlockAllSaplingNotes();
977+
std::vector<SaplingOutPoint> ListLockedSaplingNotes();
973978

974979
/**
975980
* keystore implementation

0 commit comments

Comments
 (0)