async wallet upstream chnages
This commit is contained in:
@@ -50,7 +50,7 @@ int32_t komodo_blockheight(uint256 hash);
|
|||||||
|
|
||||||
using namespace libzcash;
|
using namespace libzcash;
|
||||||
|
|
||||||
extern UniValue sendrawtransaction(const UniValue& params, bool fHelp);
|
extern UniValue sendrawtransaction(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||||
|
|
||||||
int mta_find_output(UniValue obj, int n)
|
int mta_find_output(UniValue obj, int n)
|
||||||
{
|
{
|
||||||
@@ -403,7 +403,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
|
|||||||
if (!testmode) {
|
if (!testmode) {
|
||||||
UniValue params = UniValue(UniValue::VARR);
|
UniValue params = UniValue(UniValue::VARR);
|
||||||
params.push_back(signedtxn);
|
params.push_back(signedtxn);
|
||||||
UniValue sendResultValue = sendrawtransaction(params, false);
|
UniValue sendResultValue = sendrawtransaction(params, false, CPubKey());
|
||||||
if (sendResultValue.isNull()) {
|
if (sendResultValue.isNull()) {
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "sendrawtransaction did not return an error or a txid.");
|
throw JSONRPCError(RPC_WALLET_ERROR, "sendrawtransaction did not return an error or a txid.");
|
||||||
}
|
}
|
||||||
@@ -780,7 +780,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern UniValue signrawtransaction(const UniValue& params, bool fHelp);
|
extern UniValue signrawtransaction(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sign and send a raw transaction.
|
* Sign and send a raw transaction.
|
||||||
@@ -797,7 +797,7 @@ void AsyncRPCOperation_mergetoaddress::sign_send_raw_transaction(UniValue obj)
|
|||||||
|
|
||||||
UniValue params = UniValue(UniValue::VARR);
|
UniValue params = UniValue(UniValue::VARR);
|
||||||
params.push_back(rawtxn);
|
params.push_back(rawtxn);
|
||||||
UniValue signResultValue = signrawtransaction(params, false);
|
UniValue signResultValue = signrawtransaction(params, false, CPubKey());
|
||||||
UniValue signResultObject = signResultValue.get_obj();
|
UniValue signResultObject = signResultValue.get_obj();
|
||||||
UniValue completeValue = find_value(signResultObject, "complete");
|
UniValue completeValue = find_value(signResultObject, "complete");
|
||||||
bool complete = completeValue.get_bool();
|
bool complete = completeValue.get_bool();
|
||||||
@@ -817,7 +817,7 @@ void AsyncRPCOperation_mergetoaddress::sign_send_raw_transaction(UniValue obj)
|
|||||||
params.clear();
|
params.clear();
|
||||||
params.setArray();
|
params.setArray();
|
||||||
params.push_back(signedtxn);
|
params.push_back(signedtxn);
|
||||||
UniValue sendResultValue = sendrawtransaction(params, false);
|
UniValue sendResultValue = sendrawtransaction(params, false, CPubKey());
|
||||||
if (sendResultValue.isNull()) {
|
if (sendResultValue.isNull()) {
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "Send raw transaction did not return an error or a txid.");
|
throw JSONRPCError(RPC_WALLET_ERROR, "Send raw transaction did not return an error or a txid.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,8 +57,9 @@ extern char ASSETCHAINS_SYMBOL[65];
|
|||||||
int32_t komodo_dpowconfs(int32_t height,int32_t numconfs);
|
int32_t komodo_dpowconfs(int32_t height,int32_t numconfs);
|
||||||
int32_t komodo_blockheight(uint256 hash);
|
int32_t komodo_blockheight(uint256 hash);
|
||||||
int tx_height( const uint256 &hash );
|
int tx_height( const uint256 &hash );
|
||||||
extern UniValue signrawtransaction(const UniValue& params, bool fHelp);
|
bool komodo_hardfork_active(uint32_t time);
|
||||||
extern UniValue sendrawtransaction(const UniValue& params, bool fHelp);
|
extern UniValue signrawtransaction(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||||
|
extern UniValue sendrawtransaction(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||||
|
|
||||||
int find_output(UniValue obj, int n) {
|
int find_output(UniValue obj, int n) {
|
||||||
UniValue outputMapValue = find_value(obj, "outputmap");
|
UniValue outputMapValue = find_value(obj, "outputmap");
|
||||||
@@ -375,7 +376,11 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
|||||||
// locktime to spend time locked coinbases
|
// locktime to spend time locked coinbases
|
||||||
if (ASSETCHAINS_SYMBOL[0] == 0)
|
if (ASSETCHAINS_SYMBOL[0] == 0)
|
||||||
{
|
{
|
||||||
builder_.SetLockTime((uint32_t)time(NULL) - 60); // set lock time for Komodo interest
|
//if ((uint32_t)chainActive.LastTip()->nTime < ASSETCHAINS_STAKED_HF_TIMESTAMP)
|
||||||
|
if ( !komodo_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());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CMutableTransaction rawTx(tx_);
|
CMutableTransaction rawTx(tx_);
|
||||||
@@ -388,7 +393,11 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
|||||||
}
|
}
|
||||||
if (ASSETCHAINS_SYMBOL[0] == 0)
|
if (ASSETCHAINS_SYMBOL[0] == 0)
|
||||||
{
|
{
|
||||||
rawTx.nLockTime = (uint32_t)time(NULL) - 60; // jl777
|
//if ((uint32_t)chainActive.LastTip()->nTime < ASSETCHAINS_STAKED_HF_TIMESTAMP)
|
||||||
|
if ( !komodo_hardfork_active((uint32_t)chainActive.LastTip()->nTime) )
|
||||||
|
rawTx.nLockTime = (uint32_t)time(NULL) - 60; // jl777
|
||||||
|
else
|
||||||
|
rawTx.nLockTime = (uint32_t)chainActive.Tip()->GetMedianTimePast();
|
||||||
}
|
}
|
||||||
tx_ = CTransaction(rawTx);
|
tx_ = CTransaction(rawTx);
|
||||||
}
|
}
|
||||||
@@ -521,7 +530,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
|||||||
if (!testmode) {
|
if (!testmode) {
|
||||||
UniValue params = UniValue(UniValue::VARR);
|
UniValue params = UniValue(UniValue::VARR);
|
||||||
params.push_back(signedtxn);
|
params.push_back(signedtxn);
|
||||||
UniValue sendResultValue = sendrawtransaction(params, false);
|
UniValue sendResultValue = sendrawtransaction(params, false, CPubKey());
|
||||||
if (sendResultValue.isNull()) {
|
if (sendResultValue.isNull()) {
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "sendrawtransaction did not return an error or a txid.");
|
throw JSONRPCError(RPC_WALLET_ERROR, "sendrawtransaction did not return an error or a txid.");
|
||||||
}
|
}
|
||||||
@@ -590,7 +599,12 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
|||||||
CMutableTransaction mtx(tx_);
|
CMutableTransaction mtx(tx_);
|
||||||
crypto_sign_keypair(joinSplitPubKey_.begin(), joinSplitPrivKey_);
|
crypto_sign_keypair(joinSplitPubKey_.begin(), joinSplitPrivKey_);
|
||||||
mtx.joinSplitPubKey = joinSplitPubKey_;
|
mtx.joinSplitPubKey = joinSplitPubKey_;
|
||||||
mtx.nLockTime = (uint32_t)time(NULL) - 60; // jl777
|
//if ((uint32_t)chainActive.LastTip()->nTime < ASSETCHAINS_STAKED_HF_TIMESTAMP)
|
||||||
|
if ( !komodo_hardfork_active((uint32_t)chainActive.LastTip()->nTime) )
|
||||||
|
mtx.nLockTime = (uint32_t)time(NULL) - 60; // jl777
|
||||||
|
else
|
||||||
|
mtx.nLockTime = (uint32_t)chainActive.Tip()->GetMedianTimePast();
|
||||||
|
|
||||||
tx_ = CTransaction(mtx);
|
tx_ = CTransaction(mtx);
|
||||||
|
|
||||||
// Copy zinputs and zoutputs to more flexible containers
|
// Copy zinputs and zoutputs to more flexible containers
|
||||||
@@ -983,7 +997,7 @@ void AsyncRPCOperation_sendmany::sign_send_raw_transaction(UniValue obj)
|
|||||||
|
|
||||||
UniValue params = UniValue(UniValue::VARR);
|
UniValue params = UniValue(UniValue::VARR);
|
||||||
params.push_back(rawtxn);
|
params.push_back(rawtxn);
|
||||||
UniValue signResultValue = signrawtransaction(params, false);
|
UniValue signResultValue = signrawtransaction(params, false, CPubKey());
|
||||||
UniValue signResultObject = signResultValue.get_obj();
|
UniValue signResultObject = signResultValue.get_obj();
|
||||||
UniValue completeValue = find_value(signResultObject, "complete");
|
UniValue completeValue = find_value(signResultObject, "complete");
|
||||||
bool complete = completeValue.get_bool();
|
bool complete = completeValue.get_bool();
|
||||||
@@ -1003,7 +1017,7 @@ void AsyncRPCOperation_sendmany::sign_send_raw_transaction(UniValue obj)
|
|||||||
params.clear();
|
params.clear();
|
||||||
params.setArray();
|
params.setArray();
|
||||||
params.push_back(signedtxn);
|
params.push_back(signedtxn);
|
||||||
UniValue sendResultValue = sendrawtransaction(params, false);
|
UniValue sendResultValue = sendrawtransaction(params, false, CPubKey());
|
||||||
if (sendResultValue.isNull()) {
|
if (sendResultValue.isNull()) {
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "Send raw transaction did not return an error or a txid.");
|
throw JSONRPCError(RPC_WALLET_ERROR, "Send raw transaction did not return an error or a txid.");
|
||||||
}
|
}
|
||||||
@@ -1361,7 +1375,12 @@ void AsyncRPCOperation_sendmany::add_taddr_outputs_to_tx() {
|
|||||||
CTxOut out(nAmount, scriptPubKey);
|
CTxOut out(nAmount, scriptPubKey);
|
||||||
rawTx.vout.push_back(out);
|
rawTx.vout.push_back(out);
|
||||||
}
|
}
|
||||||
rawTx.nLockTime = (uint32_t)time(NULL) - 60; // jl777
|
//if ((uint32_t)chainActive.LastTip()->nTime < ASSETCHAINS_STAKED_HF_TIMESTAMP)
|
||||||
|
if ( !komodo_hardfork_active((uint32_t)chainActive.LastTip()->nTime) )
|
||||||
|
rawTx.nLockTime = (uint32_t)time(NULL) - 60; // jl777
|
||||||
|
else
|
||||||
|
rawTx.nLockTime = (uint32_t)chainActive.Tip()->GetMedianTimePast();
|
||||||
|
|
||||||
tx_ = CTransaction(rawTx);
|
tx_ = CTransaction(rawTx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1387,7 +1406,11 @@ void AsyncRPCOperation_sendmany::add_taddr_change_output_to_tx(CBitcoinAddress *
|
|||||||
|
|
||||||
CMutableTransaction rawTx(tx_);
|
CMutableTransaction rawTx(tx_);
|
||||||
rawTx.vout.push_back(out);
|
rawTx.vout.push_back(out);
|
||||||
rawTx.nLockTime = (uint32_t)time(NULL) - 60; // jl777
|
//if ((uint32_t)chainActive.LastTip()->nTime < ASSETCHAINS_STAKED_HF_TIMESTAMP)
|
||||||
|
if ( !komodo_hardfork_active((uint32_t)chainActive.LastTip()->nTime) )
|
||||||
|
rawTx.nLockTime = (uint32_t)time(NULL) - 60; // jl777
|
||||||
|
else
|
||||||
|
rawTx.nLockTime = (uint32_t)chainActive.Tip()->GetMedianTimePast();
|
||||||
tx_ = CTransaction(rawTx);
|
tx_ = CTransaction(rawTx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -265,8 +265,8 @@ bool ShieldToAddress::operator()(const libzcash::SproutPaymentAddress &zaddr) co
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern UniValue signrawtransaction(const UniValue& params, bool fHelp);
|
extern UniValue signrawtransaction(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||||
extern UniValue sendrawtransaction(const UniValue& params, bool fHelp);
|
extern UniValue sendrawtransaction(const UniValue& params, bool fHelp, const CPubKey& mypk);
|
||||||
|
|
||||||
bool ShieldToAddress::operator()(const libzcash::SaplingPaymentAddress &zaddr) const {
|
bool ShieldToAddress::operator()(const libzcash::SaplingPaymentAddress &zaddr) const {
|
||||||
m_op->builder_.SetFee(m_op->fee_);
|
m_op->builder_.SetFee(m_op->fee_);
|
||||||
@@ -312,7 +312,7 @@ bool ShieldToAddress::operator()(const libzcash::SaplingPaymentAddress &zaddr) c
|
|||||||
if (!m_op->testmode) {
|
if (!m_op->testmode) {
|
||||||
UniValue params = UniValue(UniValue::VARR);
|
UniValue params = UniValue(UniValue::VARR);
|
||||||
params.push_back(signedtxn);
|
params.push_back(signedtxn);
|
||||||
UniValue sendResultValue = sendrawtransaction(params, false);
|
UniValue sendResultValue = sendrawtransaction(params, false, CPubKey());
|
||||||
if (sendResultValue.isNull()) {
|
if (sendResultValue.isNull()) {
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "sendrawtransaction did not return an error or a txid.");
|
throw JSONRPCError(RPC_WALLET_ERROR, "sendrawtransaction did not return an error or a txid.");
|
||||||
}
|
}
|
||||||
@@ -354,7 +354,7 @@ void AsyncRPCOperation_shieldcoinbase::sign_send_raw_transaction(UniValue obj)
|
|||||||
|
|
||||||
UniValue params = UniValue(UniValue::VARR);
|
UniValue params = UniValue(UniValue::VARR);
|
||||||
params.push_back(rawtxn);
|
params.push_back(rawtxn);
|
||||||
UniValue signResultValue = signrawtransaction(params, false);
|
UniValue signResultValue = signrawtransaction(params, false, CPubKey());
|
||||||
UniValue signResultObject = signResultValue.get_obj();
|
UniValue signResultObject = signResultValue.get_obj();
|
||||||
UniValue completeValue = find_value(signResultObject, "complete");
|
UniValue completeValue = find_value(signResultObject, "complete");
|
||||||
bool complete = completeValue.get_bool();
|
bool complete = completeValue.get_bool();
|
||||||
@@ -374,7 +374,7 @@ void AsyncRPCOperation_shieldcoinbase::sign_send_raw_transaction(UniValue obj)
|
|||||||
params.clear();
|
params.clear();
|
||||||
params.setArray();
|
params.setArray();
|
||||||
params.push_back(signedtxn);
|
params.push_back(signedtxn);
|
||||||
UniValue sendResultValue = sendrawtransaction(params, false);
|
UniValue sendResultValue = sendrawtransaction(params, false, CPubKey());
|
||||||
if (sendResultValue.isNull()) {
|
if (sendResultValue.isNull()) {
|
||||||
throw JSONRPCError(RPC_WALLET_ERROR, "Send raw transaction did not return an error or a txid.");
|
throw JSONRPCError(RPC_WALLET_ERROR, "Send raw transaction did not return an error or a txid.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user