From edfc6a787f512788bacec73743e25f34102c0137 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 2 Aug 2018 18:21:28 -0700 Subject: [PATCH] Update CWallet::IsSpent() to check Sapling nullifiers. --- src/wallet/wallet.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index cb6d6f0d2..aeeda4d6b 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -717,6 +717,16 @@ bool CWallet::IsSpent(const uint256& nullifier) const pair range; range = mapTxSproutNullifiers.equal_range(nullifier); + for (TxNullifiers::const_iterator it = range.first; it != range.second; ++it) { + const uint256& wtxid = it->second; + std::map::const_iterator mit = mapWallet.find(wtxid); + if (mit != mapWallet.end() && mit->second.GetDepthInMainChain() >= 0) { + return true; // Spent + } + } + + range = mapTxSaplingNullifiers.equal_range(nullifier); + for (TxNullifiers::const_iterator it = range.first; it != range.second; ++it) { const uint256& wtxid = it->second; std::map::const_iterator mit = mapWallet.find(wtxid);