Fix Komodo interest when z_sendmany uses builder. Sapling spend of time locked coinbases. Cheat catcher
This commit is contained in:
@@ -37,6 +37,8 @@
|
||||
|
||||
using namespace libzcash;
|
||||
|
||||
extern char ASSETCHAINS_SYMBOL[65];
|
||||
|
||||
extern UniValue signrawtransaction(const UniValue& params, bool fHelp);
|
||||
extern UniValue sendrawtransaction(const UniValue& params, bool fHelp);
|
||||
|
||||
@@ -351,6 +353,12 @@ 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 (ASSETCHAINS_SYMBOL[0] == 0)
|
||||
{
|
||||
builder_.SetLockTime((uint32_t)time(NULL) - 60); // set lock time for Komodo interest
|
||||
}
|
||||
} else {
|
||||
CMutableTransaction rawTx(tx_);
|
||||
for (SendManyInputUTXO & t : t_inputs_) {
|
||||
@@ -360,7 +368,10 @@ bool AsyncRPCOperation_sendmany::main_impl() {
|
||||
CTxIn in(COutPoint(txid, vout));
|
||||
rawTx.vin.push_back(in);
|
||||
}
|
||||
rawTx.nLockTime = (uint32_t)time(NULL) - 60; // jl777
|
||||
if (ASSETCHAINS_SYMBOL[0] == 0)
|
||||
{
|
||||
rawTx.nLockTime = (uint32_t)time(NULL) - 60; // jl777
|
||||
}
|
||||
tx_ = CTransaction(rawTx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +270,15 @@ bool ShieldToAddress::operator()(const libzcash::SaplingPaymentAddress &zaddr) c
|
||||
|
||||
// Add transparent inputs
|
||||
for (auto t : m_op->inputs_) {
|
||||
m_op->builder_.AddTransparentInput(COutPoint(t.txid, t.vout), t.scriptPubKey, t.amount);
|
||||
if (t.amount >= ASSETCHAINS_TIMELOCKGTE)
|
||||
{
|
||||
m_op->builder_.SetLockTime((uint32_t)(chainActive.Height() + 1));
|
||||
m_op->builder_.AddTransparentInput(COutPoint(t.txid, t.vout), t.scriptPubKey, t.amount, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_op->builder_.AddTransparentInput(COutPoint(t.txid, t.vout), t.scriptPubKey, t.amount);
|
||||
}
|
||||
}
|
||||
|
||||
// Send all value to the target z-addr
|
||||
|
||||
@@ -4470,7 +4470,8 @@ UniValue z_shieldcoinbase(const UniValue& params, bool fHelp)
|
||||
// (used if no Sapling addresses are involved)
|
||||
CMutableTransaction contextualTx = CreateNewContextualCMutableTransaction(
|
||||
Params().GetConsensus(), nextBlockHeight);
|
||||
contextualTx.nLockTime = blockHeight;
|
||||
contextualTx.nLockTime = nextBlockHeight;
|
||||
|
||||
if (contextualTx.nVersion == 1) {
|
||||
contextualTx.nVersion = 2; // Tx format should support vjoinsplits
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user