diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 6a29242fa..e600999b6 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4362,7 +4362,7 @@ void CWallet::GetFilteredNotes( std::string address, int minDepth, bool ignoreSpent, - bool ignoreUnspendable) + bool requireSpendingKey) { std::set filterAddresses; @@ -4370,7 +4370,7 @@ void CWallet::GetFilteredNotes( filterAddresses.insert(DecodePaymentAddress(address)); } - GetFilteredNotes(sproutEntries, saplingEntries, filterAddresses, minDepth, ignoreSpent, ignoreUnspendable); + GetFilteredNotes(sproutEntries, saplingEntries, filterAddresses, minDepth, INT_MAX, ignoreSpent, requireSpendingKey); } /** @@ -4382,8 +4382,10 @@ void CWallet::GetFilteredNotes( std::vector& saplingEntries, std::set& filterAddresses, int minDepth, + int maxDepth, bool ignoreSpent, - bool ignoreUnspendable) + bool requireSpendingKey, + bool ignoreLocked) { LOCK2(cs_main, cs_wallet); @@ -4391,7 +4393,7 @@ void CWallet::GetFilteredNotes( CWalletTx wtx = p.second; // Filter the transactions before checking for notes - if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < minDepth) { + if (!CheckFinalTx(wtx) || wtx.GetBlocksToMaturity() > 0 || wtx.GetDepthInMainChain() < minDepth || wtx.GetDepthInMainChain() > maxDepth) { continue; } @@ -4411,12 +4413,12 @@ void CWallet::GetFilteredNotes( } // skip notes which cannot be spent - if (ignoreUnspendable && !HaveSproutSpendingKey(pa)) { + if (requireSpendingKey && !HaveSproutSpendingKey(pa)) { continue; } // skip locked notes - if (IsLockedNote(jsop)) { + if (ignoreLocked && IsLockedNote(jsop)) { continue; } @@ -4477,7 +4479,7 @@ void CWallet::GetFilteredNotes( } // skip notes which cannot be spent - if (ignoreUnspendable) { + if (requireSpendingKey) { libzcash::SaplingIncomingViewingKey ivk; libzcash::SaplingFullViewingKey fvk; if (!(GetSaplingIncomingViewingKey(pa, ivk) && @@ -4489,7 +4491,7 @@ void CWallet::GetFilteredNotes( // skip locked notes // TODO: Add locking for Sapling notes - // if (IsLockedNote(jsop)) { + // if (ignoreLocked && IsLockedNote(op)) { // continue; // } diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 45918a26c..7806ae686 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1279,15 +1279,17 @@ public: std::string address, int minDepth=1, bool ignoreSpent=true, - bool ignoreUnspendable=true); + bool requireSpendingKey=true); /* Find notes filtered by payment addresses, min depth, ability to spend */ void GetFilteredNotes(std::vector& sproutEntries, std::vector& saplingEntries, std::set& filterAddresses, int minDepth=1, + int maxDepth=INT_MAX, bool ignoreSpent=true, - bool ignoreUnspendable=true); + bool requireSpendingKey=true, + bool ignoreLocked=true); /* Find unspent notes filtered by payment address, min depth and max depth */ void GetUnspentFilteredNotes(std::vector& sproutEntries,