Merge branch 'dev' into duke
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html .
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
int32_t komodo_blockheight(uint256 hash);
|
||||
int32_t hush_blockheight(uint256 hash);
|
||||
|
||||
using namespace libzcash;
|
||||
|
||||
@@ -60,7 +60,7 @@ int mta_find_output(UniValue obj, int n)
|
||||
}
|
||||
|
||||
UniValue outputMap = outputMapValue.get_array();
|
||||
assert(outputMap.size() == ZC_NUM_JS_OUTPUTS);
|
||||
assert(outputMap.size() == HUSH_NUM_JS_OUTPUTS);
|
||||
for (size_t i = 0; i < outputMap.size(); i++) {
|
||||
if (outputMap[i].get_int() == n) {
|
||||
return i;
|
||||
@@ -333,7 +333,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
|
||||
} else {
|
||||
std::string zaddr = std::get<0>(recipient_);
|
||||
std::string memo = std::get<1>(recipient_);
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> hexMemo = get_memo_from_hex_string(memo);
|
||||
std::array<unsigned char, HUSH_MEMO_SIZE> hexMemo = get_memo_from_hex_string(memo);
|
||||
auto saplingPaymentAddress = boost::get<libzcash::SaplingPaymentAddress>(&toPaymentAddress_);
|
||||
if (saplingPaymentAddress == nullptr) {
|
||||
// This should never happen as we have already determined that the payment is to sapling
|
||||
@@ -486,9 +486,9 @@ void AsyncRPCOperation_mergetoaddress::sign_send_raw_transaction(UniValue obj)
|
||||
tx_ = tx;
|
||||
}
|
||||
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> AsyncRPCOperation_mergetoaddress::get_memo_from_hex_string(std::string s)
|
||||
std::array<unsigned char, HUSH_MEMO_SIZE> AsyncRPCOperation_mergetoaddress::get_memo_from_hex_string(std::string s)
|
||||
{
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> memo = {{0x00}};
|
||||
std::array<unsigned char, HUSH_MEMO_SIZE> memo = {{0x00}};
|
||||
|
||||
std::vector<unsigned char> rawMemo = ParseHex(s.c_str());
|
||||
|
||||
@@ -498,13 +498,13 @@ std::array<unsigned char, ZC_MEMO_SIZE> AsyncRPCOperation_mergetoaddress::get_me
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Memo must be in hexadecimal format");
|
||||
}
|
||||
|
||||
if (rawMemo.size() > ZC_MEMO_SIZE) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Memo size of %d is too big, maximum allowed is %d", rawMemo.size(), ZC_MEMO_SIZE));
|
||||
if (rawMemo.size() > HUSH_MEMO_SIZE) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Memo size of %d is too big, maximum allowed is %d", rawMemo.size(), HUSH_MEMO_SIZE));
|
||||
}
|
||||
|
||||
// copy vector into boost array
|
||||
int lenMemo = rawMemo.size();
|
||||
for (int i = 0; i < ZC_MEMO_SIZE && i < lenMemo; i++) {
|
||||
for (int i = 0; i < HUSH_MEMO_SIZE && i < lenMemo; i++) {
|
||||
memo[i] = rawMemo[i];
|
||||
}
|
||||
return memo;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
@@ -99,7 +99,7 @@ private:
|
||||
TransactionBuilder builder_;
|
||||
CTransaction tx_;
|
||||
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> get_memo_from_hex_string(std::string s);
|
||||
std::array<unsigned char, HUSH_MEMO_SIZE> get_memo_from_hex_string(std::string s);
|
||||
bool main_impl();
|
||||
|
||||
void sign_send_raw_transaction(UniValue obj); // throws exception if there was an error
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
|
||||
// Delegated methods
|
||||
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> get_memo_from_hex_string(std::string s)
|
||||
std::array<unsigned char, HUSH_MEMO_SIZE> get_memo_from_hex_string(std::string s)
|
||||
{
|
||||
return delegate->get_memo_from_hex_string(s);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Copyright (c) 2019 CryptoForge
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// Copyright (c) 2016 The Zcash developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -17,7 +16,6 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "asyncrpcoperation_sendmany.h"
|
||||
#include "asyncrpcqueue.h"
|
||||
#include "amount.h"
|
||||
@@ -40,15 +38,12 @@
|
||||
#include "zcash/IncrementalMerkleTree.hpp"
|
||||
#include "sodium.h"
|
||||
#include "miner.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <string>
|
||||
|
||||
#include <boost/optional/optional_io.hpp>
|
||||
|
||||
using namespace libzcash;
|
||||
@@ -56,7 +51,7 @@ using namespace libzcash;
|
||||
extern char SMART_CHAIN_SYMBOL[65];
|
||||
|
||||
int32_t hush_dpowconfs(int32_t height,int32_t numconfs);
|
||||
int32_t komodo_blockheight(uint256 hash);
|
||||
int32_t hush_blockheight(uint256 hash);
|
||||
int tx_height( const uint256 &hash );
|
||||
bool hush_hardfork_active(uint32_t time);
|
||||
extern UniValue signrawtransaction(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||
@@ -199,11 +194,16 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
|
||||
assert(isfromtaddr_ != isfromzaddr_);
|
||||
|
||||
bool isSingleZaddrOutput = (t_outputs_.size()==0 && z_outputs_.size()==1);
|
||||
if(t_outputs_.size() > 0) {
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Extreme Privacy! You cannot send to a transparent address.");
|
||||
}
|
||||
|
||||
bool isSingleZaddrOutput = (t_outputs_.size()==0 && z_outputs_.size()==1);
|
||||
bool isMultipleZaddrOutput = (t_outputs_.size()==0 && z_outputs_.size()>=1);
|
||||
bool isPureTaddrOnlyTx = (isfromtaddr_ && z_outputs_.size() == 0);
|
||||
bool isPureTaddrOnlyTx = (isfromtaddr_ && z_outputs_.size() == 0);
|
||||
CAmount minersFee = fee_;
|
||||
|
||||
// TODO: fix this garbage ZEC prisoner mindset bullshit
|
||||
// When spending coinbase utxos, you can only specify a single zaddr as the change must go somewhere
|
||||
// and if there are multiple zaddrs, we don't know where to send it.
|
||||
if (isfromtaddr_) {
|
||||
@@ -243,12 +243,13 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
t_outputs_total += std::get<1>(t);
|
||||
}
|
||||
|
||||
|
||||
CAmount z_outputs_total = 0;
|
||||
for (SendManyRecipient & t : z_outputs_) {
|
||||
z_outputs_total += std::get<1>(t);
|
||||
}
|
||||
|
||||
CAmount sendAmount = z_outputs_total + t_outputs_total;
|
||||
CAmount sendAmount = z_outputs_total + t_outputs_total;
|
||||
CAmount targetAmount = sendAmount + minersFee;
|
||||
|
||||
assert(!isfromtaddr_ || z_inputs_total == 0);
|
||||
@@ -302,7 +303,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
FormatMoney(t_inputs_total), FormatMoney(dustThreshold - dustChange), FormatMoney(dustChange), FormatMoney(dustThreshold)));
|
||||
}
|
||||
|
||||
t_inputs_ = selectedTInputs;
|
||||
t_inputs_ = selectedTInputs;
|
||||
t_inputs_total = selectedUTXOAmount;
|
||||
|
||||
// Check mempooltxinputlimit to avoid creating a transaction which the local mempool rejects
|
||||
@@ -331,15 +332,8 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
CAmount amount = std::get<2>(t);
|
||||
builder_.AddTransparentInput(COutPoint(txid, vout), scriptPubKey, amount);
|
||||
}
|
||||
// for Komodo, set lock time to accure interest, for other chains, set
|
||||
// locktime to spend time locked coinbases
|
||||
if (SMART_CHAIN_SYMBOL[0] == 0)
|
||||
{
|
||||
if ( !hush_hardfork_active((uint32_t)chainActive.LastTip()->nTime) )
|
||||
builder_.SetLockTime((uint32_t)time(NULL) - 60); // set lock time for Komodo interest
|
||||
else
|
||||
builder_.SetLockTime((uint32_t)chainActive.Tip()->GetMedianTimePast());
|
||||
}
|
||||
// for other chains, set locktime to spend time locked coinbases
|
||||
//builder_.SetLockTime((uint32_t)chainActive.Tip()->GetMedianTimePast());
|
||||
} else {
|
||||
CMutableTransaction rawTx(tx_);
|
||||
for (SendManyInputUTXO & t : t_inputs_) {
|
||||
@@ -349,13 +343,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
CTxIn in(COutPoint(txid, vout));
|
||||
rawTx.vin.push_back(in);
|
||||
}
|
||||
if (SMART_CHAIN_SYMBOL[0] == 0)
|
||||
{
|
||||
if ( !hush_hardfork_active((uint32_t)chainActive.LastTip()->nTime) )
|
||||
rawTx.nLockTime = (uint32_t)time(NULL) - 60; // jl777
|
||||
else
|
||||
rawTx.nLockTime = (uint32_t)chainActive.Tip()->GetMedianTimePast();
|
||||
}
|
||||
//rawTx.nLockTime = (uint32_t)chainActive.Tip()->GetMedianTimePast();
|
||||
tx_ = CTransaction(rawTx);
|
||||
}
|
||||
}
|
||||
@@ -370,8 +358,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
|
||||
|
||||
/**
|
||||
* SCENARIO #0
|
||||
*
|
||||
* SCENARIO #0 (All HUSH and Hush Smart Chains)
|
||||
* Sprout not involved, so we just use the TransactionBuilder and we're done.
|
||||
* We added the transparent inputs to the builder earlier.
|
||||
*/
|
||||
@@ -516,14 +503,11 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* END SCENARIO #0
|
||||
*/
|
||||
|
||||
// END SCENARIO #0
|
||||
// No other scenarios, because Hush developers are elite.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sign and send a raw transaction.
|
||||
* Raw transaction as hex string should be in object field "rawtxn"
|
||||
@@ -579,7 +563,6 @@ void AsyncRPCOperation_sendmany::sign_send_raw_transaction(UniValue obj)
|
||||
set_result(o);
|
||||
} else {
|
||||
// Test mode does not send the transaction to the network.
|
||||
|
||||
CDataStream stream(ParseHex(signedtxn), SER_NETWORK, PROTOCOL_VERSION);
|
||||
CTransaction tx;
|
||||
stream >> tx;
|
||||
@@ -751,9 +734,9 @@ void AsyncRPCOperation_sendmany::add_taddr_change_output_to_tx(CBitcoinAddress *
|
||||
tx_ = CTransaction(rawTx);
|
||||
}
|
||||
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> AsyncRPCOperation_sendmany::get_memo_from_hex_string(std::string s) {
|
||||
std::array<unsigned char, HUSH_MEMO_SIZE> AsyncRPCOperation_sendmany::get_memo_from_hex_string(std::string s) {
|
||||
// initialize to default memo (no_memo), see section 5.5 of the protocol spec
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> memo = {{0xF6}};
|
||||
std::array<unsigned char, HUSH_MEMO_SIZE> memo = {{0xF6}};
|
||||
|
||||
std::vector<unsigned char> rawMemo = ParseHex(s.c_str());
|
||||
|
||||
@@ -763,21 +746,19 @@ std::array<unsigned char, ZC_MEMO_SIZE> AsyncRPCOperation_sendmany::get_memo_fro
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Memo must be in hexadecimal format");
|
||||
}
|
||||
|
||||
if (rawMemo.size() > ZC_MEMO_SIZE) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Memo size of %d is too big, maximum allowed is %d", rawMemo.size(), ZC_MEMO_SIZE));
|
||||
if (rawMemo.size() > HUSH_MEMO_SIZE) {
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Memo size of %d is too big, maximum allowed is %d", rawMemo.size(), HUSH_MEMO_SIZE));
|
||||
}
|
||||
|
||||
// copy vector into boost array
|
||||
int lenMemo = rawMemo.size();
|
||||
for (int i = 0; i < ZC_MEMO_SIZE && i < lenMemo; i++) {
|
||||
for (int i = 0; i < HUSH_MEMO_SIZE && i < lenMemo; i++) {
|
||||
memo[i] = rawMemo[i];
|
||||
}
|
||||
return memo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override getStatus() to append the operation's input parameters to the default status object.
|
||||
*/
|
||||
// Override getStatus() to append the operation's input parameters to the default status object.
|
||||
UniValue AsyncRPCOperation_sendmany::getStatus() const {
|
||||
UniValue v = AsyncRPCOperation::getStatus();
|
||||
if (contextinfo_.isNull()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2016 The Zcash developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -112,7 +112,7 @@ private:
|
||||
void add_taddr_outputs_to_tx();
|
||||
bool find_unspent_notes();
|
||||
bool find_utxos(bool fAcceptCoinbase);
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> get_memo_from_hex_string(std::string s);
|
||||
std::array<unsigned char, HUSH_MEMO_SIZE> get_memo_from_hex_string(std::string s);
|
||||
bool main_impl();
|
||||
|
||||
void sign_send_raw_transaction(UniValue obj); // throws exception if there was an error
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
return delegate->find_utxos(fAcceptCoinbase);
|
||||
}
|
||||
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> get_memo_from_hex_string(std::string s) {
|
||||
std::array<unsigned char, HUSH_MEMO_SIZE> get_memo_from_hex_string(std::string s) {
|
||||
return delegate->get_memo_from_hex_string(s);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -17,7 +16,6 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "asyncrpcqueue.h"
|
||||
#include "amount.h"
|
||||
#include "consensus/upgrades.h"
|
||||
@@ -39,13 +37,11 @@
|
||||
#include "zcash/IncrementalMerkleTree.hpp"
|
||||
#include "sodium.h"
|
||||
#include "miner.h"
|
||||
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <string>
|
||||
|
||||
#include "asyncrpcoperation_shieldcoinbase.h"
|
||||
|
||||
using namespace libzcash;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// Copyright (c) 2017 The Zcash developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -17,10 +16,8 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef ASYNCRPCOPERATION_SHIELDCOINBASE_H
|
||||
#define ASYNCRPCOPERATION_SHIELDCOINBASE_H
|
||||
|
||||
#include "asyncrpcoperation.h"
|
||||
#include "amount.h"
|
||||
#include "primitives/transaction.h"
|
||||
@@ -28,10 +25,8 @@
|
||||
#include "zcash/JoinSplit.hpp"
|
||||
#include "zcash/Address.hpp"
|
||||
#include "wallet.h"
|
||||
|
||||
#include <unordered_map>
|
||||
#include <tuple>
|
||||
|
||||
#include <univalue.h>
|
||||
|
||||
// Default transaction fee if caller does not specify one.
|
||||
@@ -46,15 +41,6 @@ struct ShieldCoinbaseUTXO {
|
||||
CAmount amount;
|
||||
};
|
||||
|
||||
// Package of info which is passed to perform_joinsplit methods.
|
||||
struct ShieldCoinbaseJSInfo
|
||||
{
|
||||
std::vector<JSInput> vjsin;
|
||||
std::vector<JSOutput> vjsout;
|
||||
CAmount vpub_old = 0;
|
||||
CAmount vpub_new = 0;
|
||||
};
|
||||
|
||||
class AsyncRPCOperation_shieldcoinbase : public AsyncRPCOperation {
|
||||
public:
|
||||
AsyncRPCOperation_shieldcoinbase(
|
||||
@@ -98,9 +84,6 @@ private:
|
||||
|
||||
bool main_impl();
|
||||
|
||||
// JoinSplit without any input notes to spend
|
||||
UniValue perform_joinsplit(ShieldCoinbaseJSInfo &);
|
||||
|
||||
void sign_send_raw_transaction(UniValue obj); // throws exception if there was an error
|
||||
|
||||
void lock_utxos();
|
||||
@@ -143,10 +126,6 @@ public:
|
||||
return delegate->main_impl();
|
||||
}
|
||||
|
||||
UniValue perform_joinsplit(ShieldCoinbaseJSInfo &info) {
|
||||
return delegate->perform_joinsplit(info);
|
||||
}
|
||||
|
||||
void sign_send_raw_transaction(UniValue obj) {
|
||||
delegate->sign_send_raw_transaction(obj);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2009-2013 The Bitcoin Core developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BITCOIN_WALLET_CRYPTER_H
|
||||
#define BITCOIN_WALLET_CRYPTER_H
|
||||
#ifndef HUSH_WALLET_CRYPTER_H
|
||||
#define HUSH_WALLET_CRYPTER_H
|
||||
|
||||
#include "keystore.h"
|
||||
#include "serialize.h"
|
||||
@@ -256,4 +256,4 @@ public:
|
||||
boost::signals2::signal<void (CCryptoKeyStore* wallet)> NotifyStatusChanged;
|
||||
};
|
||||
|
||||
#endif // BITCOIN_WALLET_CRYPTER_H
|
||||
#endif // HUSH_WALLET_CRYPTER_H
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BITCOIN_WALLET_DB_H
|
||||
#define BITCOIN_WALLET_DB_H
|
||||
#ifndef HUSH_WALLET_DB_H
|
||||
#define HUSH_WALLET_DB_H
|
||||
|
||||
#include "clientversion.h"
|
||||
#include "serialize.h"
|
||||
@@ -332,4 +332,4 @@ public:
|
||||
bool static Rewrite(const std::string& strFile, const char* pszSkip = NULL);
|
||||
};
|
||||
|
||||
#endif // BITCOIN_WALLET_DB_H
|
||||
#endif // HUSH_WALLET_DB_H
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
#include <gtest/gtest.h>
|
||||
@@ -34,16 +34,16 @@ TEST(Transaction, JSDescriptionRandomized) {
|
||||
|
||||
// create JSDescription
|
||||
uint256 pubKeyHash;
|
||||
boost::array<libzcash::JSInput, ZC_NUM_JS_INPUTS> inputs = {
|
||||
boost::array<libzcash::JSInput, HUSH_NUM_JS_INPUTS> inputs = {
|
||||
libzcash::JSInput(witness, note, k),
|
||||
libzcash::JSInput() // dummy input of zero value
|
||||
};
|
||||
boost::array<libzcash::JSOutput, ZC_NUM_JS_OUTPUTS> outputs = {
|
||||
boost::array<libzcash::JSOutput, HUSH_NUM_JS_OUTPUTS> outputs = {
|
||||
libzcash::JSOutput(addr, 50),
|
||||
libzcash::JSOutput(addr, 50)
|
||||
};
|
||||
std::array<size_t, ZC_NUM_JS_INPUTS> inputMap;
|
||||
std::array<size_t, ZC_NUM_JS_OUTPUTS> outputMap;
|
||||
std::array<size_t, HUSH_NUM_JS_INPUTS> inputMap;
|
||||
std::array<size_t, HUSH_NUM_JS_OUTPUTS> outputMap;
|
||||
|
||||
{
|
||||
auto jsdesc = JSDescription::Randomized(
|
||||
@@ -73,8 +73,8 @@ TEST(Transaction, JSDescriptionRandomized) {
|
||||
inputMap, outputMap,
|
||||
0, 0, false, GenZero);
|
||||
|
||||
std::array<size_t, ZC_NUM_JS_INPUTS> expectedInputMap {1, 0};
|
||||
std::array<size_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {1, 0};
|
||||
std::array<size_t, HUSH_NUM_JS_INPUTS> expectedInputMap {1, 0};
|
||||
std::array<size_t, HUSH_NUM_JS_OUTPUTS> expectedOutputMap {1, 0};
|
||||
EXPECT_EQ(expectedInputMap, inputMap);
|
||||
EXPECT_EQ(expectedOutputMap, outputMap);
|
||||
}
|
||||
@@ -86,8 +86,8 @@ TEST(Transaction, JSDescriptionRandomized) {
|
||||
inputMap, outputMap,
|
||||
0, 0, false, GenMax);
|
||||
|
||||
boost::array<size_t, ZC_NUM_JS_INPUTS> expectedInputMap {0, 1};
|
||||
boost::array<size_t, ZC_NUM_JS_OUTPUTS> expectedOutputMap {0, 1};
|
||||
boost::array<size_t, HUSH_NUM_JS_INPUTS> expectedInputMap {0, 1};
|
||||
boost::array<size_t, HUSH_NUM_JS_OUTPUTS> expectedOutputMap {0, 1};
|
||||
EXPECT_EQ(expectedInputMap, inputMap);
|
||||
EXPECT_EQ(expectedOutputMap, outputMap);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -1001,13 +1001,13 @@ UniValue z_exportviewingkey(const UniValue& params, bool fHelp, const CPubKey& m
|
||||
return EncodeViewingKey(ivk);
|
||||
}
|
||||
|
||||
extern int32_t KOMODO_NSPV;
|
||||
#ifndef KOMODO_NSPV_FULLNODE
|
||||
#define KOMODO_NSPV_FULLNODE (KOMODO_NSPV <= 0)
|
||||
#endif // !KOMODO_NSPV_FULLNODE
|
||||
#ifndef KOMODO_NSPV_SUPERLITE
|
||||
#define KOMODO_NSPV_SUPERLITE (KOMODO_NSPV > 0)
|
||||
#endif // !KOMODO_NSPV_SUPERLITE
|
||||
extern int32_t HUSH_NSPV;
|
||||
#ifndef HUSH_NSPV_FULLNODE
|
||||
#define HUSH_NSPV_FULLNODE (HUSH_NSPV <= 0)
|
||||
#endif // !HUSH_NSPV_FULLNODE
|
||||
#ifndef HUSH_NSPV_SUPERLITE
|
||||
#define HUSH_NSPV_SUPERLITE (HUSH_NSPV > 0)
|
||||
#endif // !HUSH_NSPV_SUPERLITE
|
||||
uint256 zeroid;
|
||||
UniValue NSPV_getinfo_req(int32_t reqht);
|
||||
UniValue NSPV_login(char *wifstr);
|
||||
@@ -1031,7 +1031,7 @@ UniValue nspv_getinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
int32_t reqht = 0;
|
||||
if ( fHelp || params.size() > 1 )
|
||||
throw runtime_error("nspv_getinfo [hdrheight]\n");
|
||||
if ( KOMODO_NSPV_FULLNODE )
|
||||
if ( HUSH_NSPV_FULLNODE )
|
||||
throw runtime_error("-nSPV=1 must be set to use nspv\n");
|
||||
if ( params.size() == 1 )
|
||||
reqht = atoi((char *)params[0].get_str().c_str());
|
||||
@@ -1042,7 +1042,7 @@ UniValue nspv_logout(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
{
|
||||
if ( fHelp || params.size() != 0 )
|
||||
throw runtime_error("nspv_logout\n");
|
||||
if ( KOMODO_NSPV_FULLNODE )
|
||||
if ( HUSH_NSPV_FULLNODE )
|
||||
throw runtime_error("-nSPV=1 must be set to use nspv\n");
|
||||
return(NSPV_logout());
|
||||
}
|
||||
@@ -1051,7 +1051,7 @@ UniValue nspv_login(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
{
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("nspv_login wif\n");
|
||||
if ( KOMODO_NSPV_FULLNODE )
|
||||
if ( HUSH_NSPV_FULLNODE )
|
||||
throw runtime_error("-nSPV=1 must be set to use nspv\n");
|
||||
return(NSPV_login((char *)params[0].get_str().c_str()));
|
||||
}
|
||||
@@ -1061,7 +1061,7 @@ UniValue nspv_listunspent(const UniValue& params, bool fHelp, const CPubKey& myp
|
||||
int32_t skipcount = 0,CCflag = 0;
|
||||
if ( fHelp || params.size() > 3 )
|
||||
throw runtime_error("nspv_listunspent [address [isCC [skipcount]]]\n");
|
||||
if ( KOMODO_NSPV_FULLNODE )
|
||||
if ( HUSH_NSPV_FULLNODE )
|
||||
throw runtime_error("-nSPV=1 must be set to use nspv\n");
|
||||
if ( params.size() == 0 )
|
||||
{
|
||||
@@ -1086,7 +1086,7 @@ UniValue nspv_mempool(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
memset(&txid,0,sizeof(txid));
|
||||
if ( fHelp || params.size() > 5 )
|
||||
throw runtime_error("nspv_mempool func(0 all, 1 address recv, 2 txid/vout spent, 3 txid inmempool) address isCC [txid vout]]]\n");
|
||||
if ( KOMODO_NSPV_FULLNODE )
|
||||
if ( HUSH_NSPV_FULLNODE )
|
||||
throw runtime_error("-nSPV=1 must be set to use nspv\n");
|
||||
funcid = atoi((char *)params[0].get_str().c_str());
|
||||
coinaddr = (char *)params[1].get_str().c_str();
|
||||
@@ -1106,7 +1106,7 @@ UniValue nspv_listtransactions(const UniValue& params, bool fHelp, const CPubKey
|
||||
int32_t skipcount = 0,CCflag = 0;
|
||||
if ( fHelp || params.size() > 3 )
|
||||
throw runtime_error("nspv_listtransactions [address [isCC [skipcount]]]\n");
|
||||
if ( KOMODO_NSPV_FULLNODE )
|
||||
if ( HUSH_NSPV_FULLNODE )
|
||||
throw runtime_error("-nSPV=1 must be set to use nspv\n");
|
||||
if ( params.size() == 0 )
|
||||
{
|
||||
@@ -1131,7 +1131,7 @@ UniValue nspv_spentinfo(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
uint256 txid; int32_t vout;
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("nspv_spentinfo txid vout\n");
|
||||
if ( KOMODO_NSPV_FULLNODE )
|
||||
if ( HUSH_NSPV_FULLNODE )
|
||||
throw runtime_error("-nSPV=1 must be set to use nspv\n");
|
||||
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
vout = atoi((char *)params[1].get_str().c_str());
|
||||
@@ -1143,7 +1143,7 @@ UniValue nspv_notarizations(const UniValue& params, bool fHelp, const CPubKey& m
|
||||
int32_t height;
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("nspv_notarizations height\n");
|
||||
if ( KOMODO_NSPV_FULLNODE )
|
||||
if ( HUSH_NSPV_FULLNODE )
|
||||
throw runtime_error("-nSPV=1 must be set to use nspv\n");
|
||||
height = atoi((char *)params[0].get_str().c_str());
|
||||
return(NSPV_notarizations(height));
|
||||
@@ -1154,7 +1154,7 @@ UniValue nspv_hdrsproof(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
int32_t prevheight,nextheight;
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("nspv_hdrsproof prevheight nextheight\n");
|
||||
if ( KOMODO_NSPV_FULLNODE )
|
||||
if ( HUSH_NSPV_FULLNODE )
|
||||
throw runtime_error("-nSPV=1 must be set to use nspv\n");
|
||||
prevheight = atoi((char *)params[0].get_str().c_str());
|
||||
nextheight = atoi((char *)params[1].get_str().c_str());
|
||||
@@ -1166,7 +1166,7 @@ UniValue nspv_txproof(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
uint256 txid; int32_t height;
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("nspv_txproof txid height\n");
|
||||
if ( KOMODO_NSPV_FULLNODE )
|
||||
if ( HUSH_NSPV_FULLNODE )
|
||||
throw runtime_error("-nSPV=1 must be set to use nspv\n");
|
||||
txid = Parseuint256((char *)params[0].get_str().c_str());
|
||||
height = atoi((char *)params[1].get_str().c_str());
|
||||
@@ -1178,7 +1178,7 @@ UniValue nspv_spend(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
uint64_t satoshis;
|
||||
if ( fHelp || params.size() != 2 )
|
||||
throw runtime_error("nspv_spend address amount\n");
|
||||
if ( KOMODO_NSPV_FULLNODE )
|
||||
if ( HUSH_NSPV_FULLNODE )
|
||||
throw runtime_error("-nSPV=1 must be set to use nspv\n");
|
||||
if ( NSPV_address.size() == 0 )
|
||||
throw runtime_error("to nspv_send you need an active nspv_login\n");
|
||||
@@ -1193,7 +1193,7 @@ UniValue nspv_broadcast(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
{
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("nspv_broadcast hex\n");
|
||||
if ( KOMODO_NSPV_FULLNODE )
|
||||
if ( HUSH_NSPV_FULLNODE )
|
||||
throw runtime_error("-nSPV=1 must be set to use nspv\n");
|
||||
return(NSPV_broadcast((char *)params[0].get_str().c_str()));
|
||||
}
|
||||
@@ -1207,7 +1207,7 @@ UniValue nspv_listccmoduleunspent(const UniValue& params, bool fHelp, const CPub
|
||||
"if amount is 0 just returns no utxos and available total.\n"
|
||||
"funcids is a string of funcid symbols. The first symbol is considered as the creation funcid, so the txid param will be compared to the creation tx id.\n"
|
||||
"For the second+ funcids the txid param will be compared to txid in opreturn\n\n" );
|
||||
if (KOMODO_NSPV_FULLNODE)
|
||||
if (HUSH_NSPV_FULLNODE)
|
||||
throw runtime_error("-nSPV=1 must be set to use nspv\n");
|
||||
|
||||
std::string address = params[0].get_str().c_str();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Copyright (c) 2019 Cryptoforge
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
#ifndef BITCOIN_WALLET_RPCHUSHWALLET_H
|
||||
#define BITCOIN_WALLET_RPCHUSHWALLET_H
|
||||
#ifndef HUSH_WALLET_RPCHUSHWALLET_H
|
||||
#define HUSH_WALLET_RPCHUSHWALLET_H
|
||||
|
||||
struct balancestruct {
|
||||
CAmount confirmed;
|
||||
@@ -19,4 +19,4 @@ void zsTxSendsToJSON(const CWalletTx& wtx, UniValue& sends, CAmount& totalSends,
|
||||
void zsWalletTxJSON(const CWalletTx& wtx, UniValue& ret, const std::string strAddress, bool fBool, const int returnType);
|
||||
|
||||
|
||||
#endif //BITCOIN_WALLET_RPCWALLET_H
|
||||
#endif //HUSH_WALLET_RPCWALLET_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,11 +17,11 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BITCOIN_WALLET_RPCWALLET_H
|
||||
#define BITCOIN_WALLET_RPCWALLET_H
|
||||
#ifndef HUSH_WALLET_RPCWALLET_H
|
||||
#define HUSH_WALLET_RPCWALLET_H
|
||||
|
||||
class CRPCTable;
|
||||
|
||||
void RegisterWalletRPCCommands(CRPCTable &tableRPC);
|
||||
|
||||
#endif //BITCOIN_WALLET_RPCWALLET_H
|
||||
#endif //HUSH_WALLET_RPCWALLET_H
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
// Copyright (c) 2012-2014 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
#include "wallet/wallet.h"
|
||||
|
||||
#include <set>
|
||||
#include <stdint.h>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "test/test_bitcoin.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "wallet/wallet.h"
|
||||
#include "asyncrpcqueue.h"
|
||||
#include "checkpoints.h"
|
||||
@@ -65,7 +64,7 @@ bool fSendFreeTransactions = false;
|
||||
bool fPayAtLeastCustomFee = true;
|
||||
#include "hush_defs.h"
|
||||
|
||||
CBlockIndex *komodo_chainactive(int32_t height);
|
||||
CBlockIndex *hush_chainactive(int32_t height);
|
||||
extern std::string DONATION_PUBKEY;
|
||||
int32_t hush_dpowconfs(int32_t height,int32_t numconfs);
|
||||
int tx_height( const uint256 &hash );
|
||||
@@ -915,7 +914,7 @@ void CWallet::DecrementNoteWitnesses(const CBlockIndex* pindex)
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
|
||||
extern int32_t KOMODO_REWIND;
|
||||
extern int32_t HUSH_REWIND;
|
||||
|
||||
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
|
||||
//Sapling
|
||||
@@ -934,7 +933,7 @@ void CWallet::DecrementNoteWitnesses(const CBlockIndex* pindex)
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(KOMODO_REWIND != 0 || WITNESS_CACHE_SIZE != _COINBASE_MATURITY+10);
|
||||
assert(HUSH_REWIND != 0 || WITNESS_CACHE_SIZE != _COINBASE_MATURITY+10);
|
||||
}
|
||||
|
||||
template<typename NoteData>
|
||||
@@ -1540,34 +1539,31 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
|
||||
bool fExisted = mapWallet.count(tx.GetHash()) != 0;
|
||||
if (fExisted && !fUpdate) return false;
|
||||
auto saplingNoteDataAndAddressesToAdd = FindMySaplingNotes(tx);
|
||||
auto saplingNoteData = saplingNoteDataAndAddressesToAdd.first;
|
||||
auto addressesToAdd = saplingNoteDataAndAddressesToAdd.second;
|
||||
auto saplingNoteData = saplingNoteDataAndAddressesToAdd.first;
|
||||
auto addressesToAdd = saplingNoteDataAndAddressesToAdd.second;
|
||||
for (const auto &addressToAdd : addressesToAdd) {
|
||||
if (!AddSaplingIncomingViewingKey(addressToAdd.second, addressToAdd.first)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
static std::string NotaryAddress; static bool didinit;
|
||||
if ( !didinit && NotaryAddress.empty() && NOTARY_PUBKEY33[0] != 0 )
|
||||
{
|
||||
if ( !didinit && NotaryAddress.empty() && NOTARY_PUBKEY33[0] != 0 ) {
|
||||
didinit = true;
|
||||
char Raddress[64];
|
||||
pubkey2addr((char *)Raddress,(uint8_t *)NOTARY_PUBKEY33);
|
||||
NotaryAddress.assign(Raddress);
|
||||
vWhiteListAddress = mapMultiArgs["-whitelistaddress"];
|
||||
if ( !vWhiteListAddress.empty() )
|
||||
vAllowListAddress = mapMultiArgs["-allowlistaddress"];
|
||||
if ( !vAllowListAddress.empty() )
|
||||
{
|
||||
fprintf(stderr, "Activated Wallet Filter \n Notary Address: %s \n Adding whitelist address's:\n", NotaryAddress.c_str());
|
||||
for ( auto wladdr : vWhiteListAddress )
|
||||
fprintf(stderr, "Activated Wallet Filter \n Notary Address: %s \n Adding allowlist address's:\n", NotaryAddress.c_str());
|
||||
for ( auto wladdr : vAllowListAddress )
|
||||
fprintf(stderr, " %s\n", wladdr.c_str());
|
||||
}
|
||||
}
|
||||
if (fExisted || IsMine(tx) || IsFromMe(tx) || saplingNoteData.size() > 0)
|
||||
{
|
||||
// wallet filter for notary nodes. Enables by setting -whitelistaddress= as startup param or in conf file (works same as -addnode byut with R-address's)
|
||||
if ( !tx.IsCoinBase() && !vWhiteListAddress.empty() && !NotaryAddress.empty() )
|
||||
{
|
||||
int numvinIsOurs = 0, numvinIsWhiteList = 0;
|
||||
if (fExisted || IsMine(tx) || IsFromMe(tx) || saplingNoteData.size() > 0) {
|
||||
// wallet filter for notary nodes. Enables by setting -allowlistaddress= as startup param or in conf file (works same as -addnode but with taddr)
|
||||
if ( !tx.IsCoinBase() && !vAllowListAddress.empty() && !NotaryAddress.empty() ) {
|
||||
int numvinIsOurs = 0, numvinIsAllowList = 0;
|
||||
for (size_t i = 0; i < tx.vin.size(); i++)
|
||||
{
|
||||
uint256 hash; CTransaction txin; CTxDestination address;
|
||||
@@ -1575,20 +1571,20 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
|
||||
{
|
||||
if ( CBitcoinAddress(address).ToString() == NotaryAddress )
|
||||
numvinIsOurs++;
|
||||
for ( auto wladdr : vWhiteListAddress )
|
||||
for ( auto wladdr : vAllowListAddress )
|
||||
{
|
||||
if ( CBitcoinAddress(address).ToString() == wladdr )
|
||||
{
|
||||
//fprintf(stderr, "We received from whitelisted address.%s\n", wladdr.c_str());
|
||||
numvinIsWhiteList++;
|
||||
//fprintf(stderr, "We received from allowlisted address.%s\n", wladdr.c_str());
|
||||
numvinIsAllowList++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Now we know if it was a tx sent to us, by either a whitelisted address, or ourself.
|
||||
// Now we know if it was a tx sent to us, by either a allowlisted address, or ourself.
|
||||
if ( numvinIsOurs != 0 )
|
||||
fprintf(stderr, "We sent from address: %s vins: %d\n",NotaryAddress.c_str(),numvinIsOurs);
|
||||
if ( numvinIsOurs == 0 && numvinIsWhiteList == 0 )
|
||||
if ( numvinIsOurs == 0 && numvinIsAllowList == 0 )
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1684,7 +1680,9 @@ std::pair<mapSaplingNoteData_t, SaplingIncomingViewingKeyMap> CWallet::FindMySap
|
||||
LOCK(cs_SpendingKeyStore);
|
||||
uint256 hash = tx.GetHash();
|
||||
uint32_t nZouts = tx.vShieldedOutput.size();
|
||||
LogPrintf("%s: zouts=%d in tx=%s\n",__func__,nZouts, hash.ToString().c_str());
|
||||
if(fDebug && (nZouts > 0)) {
|
||||
LogPrintf("%s: zouts=%d in tx=%s\n",__func__,nZouts, hash.ToString().c_str());
|
||||
}
|
||||
|
||||
mapSaplingNoteData_t noteData;
|
||||
SaplingIncomingViewingKeyMap viewingKeysToAdd;
|
||||
@@ -1809,7 +1807,7 @@ CAmount CWallet::GetDebit(const CTxIn &txin, const isminefilter& filter) const
|
||||
const CWalletTx& prev = (*mi).second;
|
||||
if (txin.prevout.n < prev.vout.size())
|
||||
if (::IsMine(*this, prev.vout[txin.prevout.n].scriptPubKey) & filter)
|
||||
return prev.vout[txin.prevout.n].nValue; // komodo_interest?
|
||||
return prev.vout[txin.prevout.n].nValue;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -3050,7 +3048,7 @@ std::vector<uint256> CWallet::ResendWalletTransactionsBefore(int64_t nTime)
|
||||
if (wtx.nTimeReceived > nTime)
|
||||
continue;
|
||||
|
||||
if ( (wtx.nLockTime >= LOCKTIME_THRESHOLD && wtx.nLockTime < now-KOMODO_MAXMEMPOOLTIME) )
|
||||
if ( (wtx.nLockTime >= LOCKTIME_THRESHOLD && wtx.nLockTime < now-HUSH_MAXMEMPOOLTIME) )
|
||||
{
|
||||
//LogPrintf("skip Relaying wtx %s nLockTime %u vs now.%u\n", wtx.GetHash().ToString(),(uint32_t)wtx.nLockTime,now);
|
||||
//vwtxh.push_back(wtx.GetHash());
|
||||
@@ -3201,8 +3199,6 @@ CAmount CWallet::GetImmatureWatchOnlyBalance() const
|
||||
/**
|
||||
* populate vCoins with vector of available COutputs.
|
||||
*/
|
||||
uint64_t komodo_interestnew(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime);
|
||||
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight);
|
||||
|
||||
void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl, bool fIncludeZeroValue, bool fIncludeCoinBase) const
|
||||
{
|
||||
@@ -3239,8 +3235,7 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const
|
||||
!IsLockedCoin((*it).first, i) && (pcoin->vout[i].nValue > 0 || fIncludeZeroValue) &&
|
||||
(!coinControl || !coinControl->HasSelected() || coinControl->IsSelected((*it).first, i)))
|
||||
{
|
||||
if ( KOMODO_EXCHANGEWALLET == 0 )
|
||||
{
|
||||
if ( 1 ) {
|
||||
uint32_t locktime; int32_t txheight; CBlockIndex *tipindex;
|
||||
if ( SMART_CHAIN_SYMBOL[0] == 0 && chainActive.LastTip() != 0 && chainActive.LastTip()->GetHeight() >= 60000 )
|
||||
{
|
||||
@@ -3248,34 +3243,22 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const
|
||||
{
|
||||
if ( (tipindex= chainActive.LastTip()) != 0 )
|
||||
{
|
||||
komodo_accrued_interest(&txheight,&locktime,wtxid,i,0,pcoin->vout[i].nValue,(int32_t)tipindex->GetHeight());
|
||||
interest = komodo_interestnew(txheight,pcoin->vout[i].nValue,locktime,tipindex->nTime);
|
||||
interest = 0;
|
||||
} else interest = 0;
|
||||
//interest = komodo_interestnew(chainActive.LastTip()->GetHeight()+1,pcoin->vout[i].nValue,pcoin->nLockTime,chainActive.LastTip()->nTime);
|
||||
if ( interest != 0 )
|
||||
{
|
||||
//printf("wallet nValueRet %.8f += interest %.8f ht.%d lock.%u/%u tip.%u\n",(double)pcoin->vout[i].nValue/COIN,(double)interest/COIN,txheight,locktime,pcoin->nLockTime,tipindex->nTime);
|
||||
//fprintf(stderr,"wallet nValueRet %.8f += interest %.8f ht.%d lock.%u tip.%u\n",(double)pcoin->vout[i].nValue/COIN,(double)interest/COIN,chainActive.LastTip()->GetHeight()+1,pcoin->nLockTime,chainActive.LastTip()->nTime);
|
||||
//ptr = (uint64_t *)&pcoin->vout[i].nValue;
|
||||
//(*ptr) += interest;
|
||||
ptr = (uint64_t *)&pcoin->vout[i].interest;
|
||||
(*ptr) = interest;
|
||||
//pcoin->vout[i].nValue += interest;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ptr = (uint64_t *)&pcoin->vout[i].interest;
|
||||
(*ptr) = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ptr = (uint64_t *)&pcoin->vout[i].interest;
|
||||
(*ptr) = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ptr = (uint64_t *)&pcoin->vout[i].interest;
|
||||
(*ptr) = 0;
|
||||
}
|
||||
@@ -3366,30 +3349,20 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
|
||||
{
|
||||
setCoinsRet.insert(coin.second);
|
||||
nValueRet += coin.first;
|
||||
//if ( KOMODO_EXCHANGEWALLET == 0 )
|
||||
// *interestp += pcoin->vout[i].interest;
|
||||
return true;
|
||||
}
|
||||
else if (n < nTargetValue + CENT)
|
||||
{
|
||||
vValue.push_back(coin);
|
||||
nTotalLower += n;
|
||||
//if ( KOMODO_EXCHANGEWALLET == 0 && count < sizeof(interests)/sizeof(*interests) )
|
||||
//{
|
||||
//fprintf(stderr,"count.%d %.8f\n",count,(double)pcoin->vout[i].interest/COIN);
|
||||
//interests[count++] = pcoin->vout[i].interest;
|
||||
//}
|
||||
if ( nTotalLower > 4*nTargetValue + CENT )
|
||||
{
|
||||
//fprintf(stderr,"why bother with all the utxo if we have double what is needed?\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (n < coinLowestLarger.first)
|
||||
} else if (n < coinLowestLarger.first)
|
||||
{
|
||||
coinLowestLarger = coin;
|
||||
//if ( KOMODO_EXCHANGEWALLET == 0 )
|
||||
// lowest_interest = pcoin->vout[i].interest;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3399,8 +3372,6 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
|
||||
{
|
||||
setCoinsRet.insert(vValue[i].second);
|
||||
nValueRet += vValue[i].first;
|
||||
//if ( KOMODO_EXCHANGEWALLET == 0 && i < count )
|
||||
// *interestp += interests[i];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -3411,8 +3382,6 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
|
||||
return false;
|
||||
setCoinsRet.insert(coinLowestLarger.second);
|
||||
nValueRet += coinLowestLarger.first;
|
||||
//if ( KOMODO_EXCHANGEWALLET == 0 )
|
||||
// *interestp += lowest_interest;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3432,17 +3401,12 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
|
||||
{
|
||||
setCoinsRet.insert(coinLowestLarger.second);
|
||||
nValueRet += coinLowestLarger.first;
|
||||
//if ( KOMODO_EXCHANGEWALLET == 0 )
|
||||
// *interestp += lowest_interest;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for (unsigned int i = 0; i < vValue.size(); i++)
|
||||
if (vfBest[i])
|
||||
{
|
||||
setCoinsRet.insert(vValue[i].second);
|
||||
nValueRet += vValue[i].first;
|
||||
//if ( KOMODO_EXCHANGEWALLET == 0 && i < count )
|
||||
// *interestp += interests[i];
|
||||
}
|
||||
|
||||
LogPrint("selectcoins", "SelectCoins() best subset: ");
|
||||
@@ -3459,11 +3423,6 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
|
||||
{
|
||||
// Output parameter fOnlyCoinbaseCoinsRet is set to true when the only available coins are coinbase utxos.
|
||||
uint64_t tmp; int32_t retval;
|
||||
//if ( interestp == 0 )
|
||||
//{
|
||||
// interestp = &tmp;
|
||||
// *interestp = 0;
|
||||
//}
|
||||
vector<COutput> vCoinsNoCoinbase, vCoinsWithCoinbase;
|
||||
AvailableCoins(vCoinsNoCoinbase, true, coinControl, false, false);
|
||||
AvailableCoins(vCoinsWithCoinbase, true, coinControl, false, true);
|
||||
@@ -3481,8 +3440,7 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
|
||||
continue;
|
||||
}
|
||||
value += out.tx->vout[out.i].nValue;
|
||||
if ( KOMODO_EXCHANGEWALLET == 0 )
|
||||
value += out.tx->vout[out.i].interest;
|
||||
value += out.tx->vout[out.i].interest;
|
||||
}
|
||||
if (value <= nTargetValue) {
|
||||
CAmount valueWithCoinbase = 0;
|
||||
@@ -3491,8 +3449,7 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
|
||||
continue;
|
||||
}
|
||||
valueWithCoinbase += out.tx->vout[out.i].nValue;
|
||||
if ( KOMODO_EXCHANGEWALLET == 0 )
|
||||
valueWithCoinbase += out.tx->vout[out.i].interest;
|
||||
valueWithCoinbase += out.tx->vout[out.i].interest;
|
||||
}
|
||||
fNeedCoinbaseCoinsRet = (valueWithCoinbase >= nTargetValue);
|
||||
}
|
||||
@@ -3505,8 +3462,6 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
|
||||
if (!out.fSpendable)
|
||||
continue;
|
||||
nValueRet += out.tx->vout[out.i].nValue;
|
||||
//if ( KOMODO_EXCHANGEWALLET == 0 )
|
||||
// *interestp += out.tx->vout[out.i].interest;
|
||||
setCoinsRet.insert(make_pair(out.tx, out.i));
|
||||
}
|
||||
return (nValueRet >= nTargetValue);
|
||||
@@ -3528,8 +3483,7 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
|
||||
if (pcoin->vout.size() <= outpoint.n)
|
||||
return false;
|
||||
nValueFromPresetInputs += pcoin->vout[outpoint.n].nValue;
|
||||
if ( KOMODO_EXCHANGEWALLET == 0 )
|
||||
nValueFromPresetInputs += pcoin->vout[outpoint.n].interest;
|
||||
nValueFromPresetInputs += pcoin->vout[outpoint.n].interest;
|
||||
setPresetCoins.insert(make_pair(pcoin, outpoint.n));
|
||||
} else
|
||||
return false; // TODO: Allow non-wallet inputs
|
||||
@@ -3744,7 +3698,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||
//a chance at a free transaction.
|
||||
//But mempool inputs might still be in the mempool, so their age stays 0
|
||||
//fprintf(stderr,"nCredit %.8f interest %.8f\n",(double)nCredit/COIN,(double)pcoin.first->vout[pcoin.second].interest/COIN);
|
||||
if ( KOMODO_EXCHANGEWALLET == 0 && SMART_CHAIN_SYMBOL[0] == 0 )
|
||||
if ( SMART_CHAIN_SYMBOL[0] == 0 )
|
||||
{
|
||||
interest2 += pcoin.first->vout[pcoin.second].interest;
|
||||
//fprintf(stderr,"%.8f ",(double)pcoin.first->vout[pcoin.second].interest/COIN);
|
||||
@@ -3754,11 +3708,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||
age += 1;
|
||||
dPriority += (double)nCredit * age;
|
||||
}
|
||||
//if ( KOMODO_EXCHANGEWALLET != 0 )
|
||||
//{
|
||||
//fprintf(stderr,"KOMODO_EXCHANGEWALLET disable interest sum %.8f, interest2 %.8f\n",(double)interest/COIN,(double)interest2/COIN);
|
||||
//interest = 0; // interest2 also
|
||||
//}
|
||||
//TODO: delete this
|
||||
if ( SMART_CHAIN_SYMBOL[0] == 0 && DONATION_PUBKEY.size() == 66 && interest2 > 5000 )
|
||||
{
|
||||
CScript scriptDonation = CScript() << ParseHex(DONATION_PUBKEY) << OP_CHECKSIG;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BITCOIN_WALLET_WALLET_H
|
||||
#define BITCOIN_WALLET_WALLET_H
|
||||
#ifndef HUSH_WALLET_WALLET_H
|
||||
#define HUSH_WALLET_WALLET_H
|
||||
|
||||
#include "amount.h"
|
||||
#include "asyncrpcoperation.h"
|
||||
@@ -203,7 +203,7 @@ public:
|
||||
uint256 hash;
|
||||
// Index into CTransaction.vjoinsplit
|
||||
uint64_t js;
|
||||
// Index into JSDescription fields of length ZC_NUM_JS_OUTPUTS
|
||||
// Index into JSDescription fields of length HUSH_NUM_JS_OUTPUTS
|
||||
uint8_t n;
|
||||
|
||||
JSOutPoint() { SetNull(); }
|
||||
@@ -347,7 +347,7 @@ struct SaplingNoteEntry
|
||||
SaplingOutPoint op;
|
||||
libzcash::SaplingPaymentAddress address;
|
||||
libzcash::SaplingNote note;
|
||||
std::array<unsigned char, ZC_MEMO_SIZE> memo;
|
||||
std::array<unsigned char, HUSH_MEMO_SIZE> memo;
|
||||
int confirmations;
|
||||
};
|
||||
|
||||
@@ -1499,4 +1499,4 @@ public:
|
||||
|
||||
#define RETURN_IF_ERROR(CCerror) if ( CCerror != "" ) { ERR_RESULT(CCerror); return(result); }
|
||||
|
||||
#endif // BITCOIN_WALLET_WALLET_H
|
||||
#endif // HUSH_WALLET_WALLET_H
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BITCOIN_WALLET_WALLET_ISMINE_H
|
||||
#define BITCOIN_WALLET_WALLET_ISMINE_H
|
||||
#ifndef HUSH_WALLET_WALLET_ISMINE_H
|
||||
#define HUSH_WALLET_WALLET_ISMINE_H
|
||||
|
||||
#include "key.h"
|
||||
#include "script/standard.h"
|
||||
@@ -43,4 +43,4 @@ typedef uint8_t isminefilter;
|
||||
isminetype IsMine(const CKeyStore& keystore, const CScript& scriptPubKey);
|
||||
isminetype IsMine(const CKeyStore& keystore, const CTxDestination& dest);
|
||||
|
||||
#endif // BITCOIN_WALLET_WALLET_ISMINE_H
|
||||
#endif // HUSH_WALLET_WALLET_ISMINE_H
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2019-2020 The Hush developers
|
||||
// Copyright (c) 2016-2020 The Hush developers
|
||||
// Distributed under the GPLv3 software license, see the accompanying
|
||||
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
|
||||
/******************************************************************************
|
||||
* Copyright © 2014-2019 The SuperNET Developers. *
|
||||
* *
|
||||
@@ -18,9 +17,7 @@
|
||||
* Removal or modification of this copyright notice is prohibited. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#include "wallet/walletdb.h"
|
||||
|
||||
#include "consensus/validation.h"
|
||||
#include "key_io.h"
|
||||
#include "main.h"
|
||||
@@ -32,7 +29,6 @@
|
||||
#include "wallet/wallet.h"
|
||||
#include "zcash/Proof.hpp"
|
||||
#include "hush_defs.h"
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
@@ -42,7 +38,7 @@ using namespace std;
|
||||
|
||||
static uint64_t nAccountingEntryNumber = 0;
|
||||
static list<uint256> deadTxns;
|
||||
extern CBlockIndex *komodo_blockindex(uint256 hash);
|
||||
extern CBlockIndex *hush_blockindex(uint256 hash);
|
||||
|
||||
//
|
||||
// CWalletDB
|
||||
@@ -936,7 +932,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
|
||||
if (!EraseTx(hash))
|
||||
fprintf(stderr, "could not delete tx.%s\n",hash.ToString().c_str());
|
||||
uint256 blockhash; CTransaction tx; CBlockIndex* pindex;
|
||||
if ( GetTransaction(hash,tx,blockhash,false) && (pindex= komodo_blockindex(blockhash)) != 0 && chainActive.Contains(pindex) )
|
||||
if ( GetTransaction(hash,tx,blockhash,false) && (pindex= hush_blockindex(blockhash)) != 0 && chainActive.Contains(pindex) )
|
||||
{
|
||||
CWalletTx wtx(pwallet,tx);
|
||||
pwallet->AddToWallet(wtx, true, NULL);
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef BITCOIN_WALLET_WALLETDB_H
|
||||
#define BITCOIN_WALLET_WALLETDB_H
|
||||
#ifndef HUSH_WALLET_WALLETDB_H
|
||||
#define HUSH_WALLET_WALLETDB_H
|
||||
|
||||
#include "amount.h"
|
||||
#include "wallet/db.h"
|
||||
@@ -219,4 +219,4 @@ private:
|
||||
bool BackupWallet(const CWallet& wallet, const std::string& strDest);
|
||||
void ThreadFlushWalletDB(const std::string& strFile);
|
||||
|
||||
#endif // BITCOIN_WALLET_WALLETDB_H
|
||||
#endif // HUSH_WALLET_WALLETDB_H
|
||||
|
||||
Reference in New Issue
Block a user