From 52332fb4176a50613e783f13147e701bbe825758 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 28 Jul 2018 10:06:55 -0700 Subject: [PATCH] Create CWallet::AddToSaplingSpends() to track Sapling nullifiers. --- src/wallet/wallet.cpp | 17 ++++++++++++----- src/wallet/wallet.h | 2 ++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index ce34c4cc9..2e09f5546 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -758,6 +758,18 @@ void CWallet::AddToSpends(const uint256& wtxid) AddToSproutSpends(nullifier, wtxid); } } + for (const SpendDescription &spend : thisTx.vShieldedSpend) { + AddToSaplingSpends(spend.nullifier, wtxid); + } +} + +void CWallet::AddToSaplingSpends(const uint256& nullifier, const uint256& wtxid) +{ + mapTxSaplingNullifiers.insert(make_pair(nullifier, wtxid)); + + pair range; + range = mapTxSaplingNullifiers.equal_range(nullifier); + SyncMetaData(range); } void CWallet::ClearNoteWitnessCache() @@ -1248,12 +1260,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletD wtxIn.GetHash().ToString(), wtxIn.hashBlock.ToString()); } -<<<<<<< HEAD - AddToSproutSpends(hash); -======= AddToSpends(hash); - AddToSaplingSpends(hash); ->>>>>>> e9b1ce0... fix } bool fUpdated = false; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index b369c0186..4c0188138 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -726,10 +726,12 @@ private: */ typedef TxSpendMap TxNullifiers; TxNullifiers mapTxSproutNullifiers; + TxNullifiers mapTxSaplingNullifiers; void AddToTransparentSpends(const COutPoint& outpoint, const uint256& wtxid); void AddToSproutSpends(const uint256& nullifier, const uint256& wtxid); void AddToSpends(const uint256& wtxid); + void AddToSaplingSpends(const uint256& nullifier, const uint256& wtxid); public: /*