Browse Source

Fix non-final sequence and nLockTime

pull/4/head
miketout 6 years ago
parent
commit
4ac64cd2a0
  1. 6
      src/wallet/asyncrpcoperation_shieldcoinbase.cpp
  2. 2
      src/wallet/rpcwallet.cpp

6
src/wallet/asyncrpcoperation_shieldcoinbase.cpp

@ -225,7 +225,7 @@ bool ShieldToAddress::operator()(const libzcash::SproutPaymentAddress &zaddr) co
for (ShieldCoinbaseUTXO & t : m_op->inputs_) {
CTxIn in(COutPoint(t.txid, t.vout));
if (t.amount >= ASSETCHAINS_TIMELOCKGTE)
in.nSequence = 0;
in.nSequence = 0xfffffffe;
rawTx.vin.push_back(in);
}
m_op->tx_ = CTransaction(rawTx);
@ -272,8 +272,8 @@ bool ShieldToAddress::operator()(const libzcash::SaplingPaymentAddress &zaddr) c
for (auto t : m_op->inputs_) {
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);
m_op->builder_.SetLockTime((uint32_t)(chainActive.Height()));
m_op->builder_.AddTransparentInput(COutPoint(t.txid, t.vout), t.scriptPubKey, t.amount, 0xfffffffe);
}
else
{

2
src/wallet/rpcwallet.cpp

@ -4487,7 +4487,7 @@ UniValue z_shieldcoinbase(const UniValue& params, bool fHelp)
// (used if no Sapling addresses are involved)
CMutableTransaction contextualTx = CreateNewContextualCMutableTransaction(
Params().GetConsensus(), nextBlockHeight);
contextualTx.nLockTime = nextBlockHeight;
contextualTx.nLockTime = chainActive.LastTip()->GetHeight();
if (contextualTx.nVersion == 1) {
contextualTx.nVersion = 2; // Tx format should support vjoinsplits

Loading…
Cancel
Save