Untested sapling consolidation plus sietch outputs to reduce metadata leakage

This commit is contained in:
Duke Leto
2020-03-04 09:17:05 -05:00
parent 21ec2e7260
commit dc7525f12e
4 changed files with 26 additions and 4 deletions

View File

@@ -24,6 +24,7 @@
#include "komodo_defs.h"
#include "script/standard.h"
#include "cc/CCinclude.h"
#include "sietch.h"
int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp);
int32_t komodo_electednotary(int32_t *numnotariesp,uint8_t *pubkey33,int32_t height,uint32_t timestamp);

View File

@@ -1,3 +1,8 @@
// 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 "assert.h"
#include "boost/variant/static_visitor.hpp"
#include "asyncrpcoperation_saplingconsolidation.h"
@@ -11,11 +16,13 @@
#include "util.h"
#include "utilmoneystr.h"
#include "wallet.h"
//#include "sietch.h"
CAmount fConsolidationTxFee = DEFAULT_CONSOLIDATION_FEE;
bool fConsolidationMapUsed = false;
const int CONSOLIDATION_EXPIRY_DELTA = 15;
extern string randomSietchZaddr();
AsyncRPCOperation_saplingconsolidation::AsyncRPCOperation_saplingconsolidation(int targetHeight) : targetHeight_(targetHeight) {}
@@ -168,10 +175,22 @@ bool AsyncRPCOperation_saplingconsolidation::main_impl() {
builder.SetFee(fConsolidationTxFee);
//TODO: we want at least 2 zouts and potentially Sietch
// We could split funds into 2 parts and send as 2 zouts
// or add amount=0 sietch zaddrs
// Add the actual consolidation tx
builder.AddSaplingOutput(extsk.expsk.ovk, addr, amountToSend - fConsolidationTxFee);
// Add sietch zouts
int MIN_ZOUTS = 7;
for(size_t i = 0; i < MIN_ZOUTS; i++) {
// In Privacy Zdust We Trust -- Duke
string zdust = randomSietchZaddr();
LogPrint("zrpcunsafe", "%s: Adding sietch output", getId(), zdust);
auto zaddr = DecodePaymentAddress(zdust);
if (IsValidPaymentAddress(zaddr)) {
auto sietchZoutput = boost::get<libzcash::SaplingPaymentAddress>(zaddr);
int amount=0;
builder.AddSaplingOutput(extsk.expsk.ovk, sietchZoutput, amount);
}
}
//CTransaction tx = builder.Build();
auto maybe_tx = builder.Build();

View File

@@ -62,7 +62,7 @@
#include "komodo_defs.h"
#include <string.h>
#include "sietch.h"
//#include "sietch.h"
#include "rpchushwallet.h"
using namespace std;
@@ -79,6 +79,7 @@ uint32_t komodo_segid32(char *coinaddr);
int32_t komodo_dpowconfs(int32_t height,int32_t numconfs);
int32_t komodo_isnotaryvout(char *coinaddr,uint32_t tiptime); // from ac_private chains only
CBlockIndex *komodo_getblockindex(uint256 hash);
extern string randomSietchZaddr();
int64_t nWalletUnlockTime;
static CCriticalSection cs_nWalletUnlockTime;

View File

@@ -42,6 +42,7 @@
#include "zcash/Address.hpp"
#include "zcash/zip32.h"
#include "base58.h"
//#include "sietch.h"
#include <algorithm>
#include <map>