Browse Source

Change consolidation fee to be the default instead of zero and require zinput arity to be inside [3,8]

pull/94/head
Duke Leto 4 years ago
parent
commit
9c72f4c2f5
  1. 13
      src/wallet/asyncrpcoperation_saplingconsolidation.cpp
  2. 11
      src/wallet/asyncrpcoperation_saplingconsolidation.h

13
src/wallet/asyncrpcoperation_saplingconsolidation.cpp

@ -120,7 +120,10 @@ bool AsyncRPCOperation_saplingconsolidation::main_impl() {
std::vector<SaplingNoteEntry> fromNotes;
CAmount amountToSend = 0;
int maxQuantity = rand() % 35 + 10;
// max of 8 zins means the tx cannot reduce the anonset,
// since there will be 8 zins and 8 zouts at worst case
// This also helps reduce ztx creation time
int maxQuantity = rand() % 8 + 1;
for (const SaplingNoteEntry& saplingEntry : saplingEntries) {
libzcash::SaplingIncomingViewingKey ivk;
@ -132,14 +135,16 @@ bool AsyncRPCOperation_saplingconsolidation::main_impl() {
fromNotes.push_back(saplingEntry);
}
//Only use a randomly determined number of notes between 10 and 45
//Only use a randomly determined number of notes
if (fromNotes.size() >= maxQuantity)
break;
}
//random minimum 2 - 12 required
int minQuantity = rand() % 10 + 2;
// minimum required
// We use 3 so that addresses can spent one zutxo and still have another zutxo to use while that
// tx is confirming
int minQuantity = 3;
if (fromNotes.size() < minQuantity)
continue;

11
src/wallet/asyncrpcoperation_saplingconsolidation.h

@ -1,11 +1,16 @@
// Copyright (c) 2020 The Hush developers
// TODO: Forge should add his preferred copyright line here
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "amount.h"
#include "asyncrpcoperation.h"
#include "univalue.h"
#include "zcash/Address.hpp"
#include "zcash/zip32.h"
//Default fee used for consolidation transactions
static const CAmount DEFAULT_CONSOLIDATION_FEE = 0;
//Default fee used for consolidation transactions, in puposhis
static const CAmount DEFAULT_CONSOLIDATION_FEE = 10000;
extern CAmount fConsolidationTxFee;
extern bool fConsolidationMapUsed;
@ -34,4 +39,4 @@ private:
void setConsolidationResult(int numTxCreated, const CAmount& amountConsolidated, const std::vector<std::string>& consolidationTxIds);
};
};

Loading…
Cancel
Save