diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index b89aa5c0a..b5e825a58 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -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); diff --git a/src/wallet/asyncrpcoperation_saplingconsolidation.cpp b/src/wallet/asyncrpcoperation_saplingconsolidation.cpp index 26809f2b8..0d1599916 100644 --- a/src/wallet/asyncrpcoperation_saplingconsolidation.cpp +++ b/src/wallet/asyncrpcoperation_saplingconsolidation.cpp @@ -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(zaddr); + int amount=0; + builder.AddSaplingOutput(extsk.expsk.ovk, sietchZoutput, amount); + } + } //CTransaction tx = builder.Build(); auto maybe_tx = builder.Build(); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 79dab0c5b..8f5688026 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -62,7 +62,7 @@ #include "komodo_defs.h" #include -#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; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 79d24a86d..6b9a1d628 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -42,6 +42,7 @@ #include "zcash/Address.hpp" #include "zcash/zip32.h" #include "base58.h" +//#include "sietch.h" #include #include