diff --git a/src/wallet/asyncrpcoperation_saplingconsolidation.cpp b/src/wallet/asyncrpcoperation_saplingconsolidation.cpp index 8f7078c81..33610d4e7 100644 --- a/src/wallet/asyncrpcoperation_saplingconsolidation.cpp +++ b/src/wallet/asyncrpcoperation_saplingconsolidation.cpp @@ -95,7 +95,12 @@ bool AsyncRPCOperation_saplingconsolidation::main_impl() { // We set minDepth to 11 to avoid unconfirmed notes and in anticipation of specifying // an anchor at height N-10 for each Sprout JoinSplit description // Consider, should notes be sorted? - pwalletMain->GetFilteredNotes(sproutEntries, saplingEntries, "", 11); + bool ignoreSpent=true; + bool requireSpendingKey=true; + bool ignoreLocked=true; + bool ignoreZeroValue=false; + + pwalletMain->GetFilteredNotes(sproutEntries, saplingEntries, "", 11, ignoreSpent, requireSpendingKey, ignoreLocked, ignoreZeroValue); if (fConsolidationMapUsed) { const vector& v = mapMultiArgs["-consolidatesaplingaddress"]; for(int i = 0; i < v.size(); i++) { diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 53b3af6a6..d523e4107 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -5323,7 +5323,9 @@ void CWallet::GetFilteredNotes( std::string address, int minDepth, bool ignoreSpent, - bool requireSpendingKey) + bool requireSpendingKey, + bool ignoreLocked, + bool ignoreZeroValue) { std::set filterAddresses; @@ -5331,7 +5333,7 @@ void CWallet::GetFilteredNotes( filterAddresses.insert(DecodePaymentAddress(address)); } - GetFilteredNotes(sproutEntries, saplingEntries, filterAddresses, minDepth, INT_MAX, ignoreSpent, requireSpendingKey); + GetFilteredNotes(sproutEntries, saplingEntries, filterAddresses, minDepth, INT_MAX, ignoreSpent, requireSpendingKey, ignoreLocked, ignoreZeroValue); } /** @@ -5347,7 +5349,8 @@ void CWallet::GetFilteredNotes( int maxDepth, bool ignoreSpent, bool requireSpendingKey, - bool ignoreLocked) + bool ignoreLocked, + bool ignoreZeroValue) { LOCK2(cs_main, cs_wallet); @@ -5417,6 +5420,14 @@ void CWallet::GetFilteredNotes( continue; } + // Most code does not want amount=0 zutxos + // except sapling consolidation + if (ignoreZeroValue) { + if (notePt.value() == 0) { + continue; + } + } + auto note = notePt.note(nd.ivk).get(); saplingEntries.push_back(SaplingNoteEntry { op, pa, note, notePt.memo(), wtx.GetDepthInMainChain() }); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 205a49008..a3a9051b7 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1372,7 +1372,9 @@ public: std::string address, int minDepth=1, bool ignoreSpent=true, - bool requireSpendingKey=true); + bool requireSpendingKey=true, + bool ignoreLocked=true, + bool ignoreZeroValue=true); /* Find notes filtered by payment addresses, min depth, max depth, if they are spent, if a spending key is required, and if they are locked */ @@ -1383,7 +1385,8 @@ public: int maxDepth=INT_MAX, bool ignoreSpent=true, bool requireSpendingKey=true, - bool ignoreLocked=true); + bool ignoreLocked=true, + bool ignoreZeroValue=true); };