Fix non-final sequence and nLockTime

This commit is contained in:
miketout
2018-11-01 11:08:20 -07:00
parent a9774a32f7
commit 4ac64cd2a0
2 changed files with 4 additions and 4 deletions

View File

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

View File

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