From 4ac64cd2a0eec1f23548caaeec3471e8c86d8d08 Mon Sep 17 00:00:00 2001 From: miketout Date: Thu, 1 Nov 2018 11:08:20 -0700 Subject: [PATCH] Fix non-final sequence and nLockTime --- src/wallet/asyncrpcoperation_shieldcoinbase.cpp | 6 +++--- src/wallet/rpcwallet.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wallet/asyncrpcoperation_shieldcoinbase.cpp b/src/wallet/asyncrpcoperation_shieldcoinbase.cpp index 11aa1037f..dfc51aa3a 100644 --- a/src/wallet/asyncrpcoperation_shieldcoinbase.cpp +++ b/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 { diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 18b76a956..c56685c85 100644 --- a/src/wallet/rpcwallet.cpp +++ b/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