Compare commits

...

1 Commits

  1. 7
      src/wallet/asyncrpcoperation_saplingconsolidation.cpp
  2. 17
      src/wallet/wallet.cpp
  3. 7
      src/wallet/wallet.h

7
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<string>& v = mapMultiArgs["-consolidatesaplingaddress"];
for(int i = 0; i < v.size(); i++) {

17
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<PaymentAddress> 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() });

7
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);
};

Loading…
Cancel
Save