From 10c3389f17997fd774d678fd6eb854bde838f356 Mon Sep 17 00:00:00 2001 From: CalDescent <> Date: Wed, 18 May 2022 19:25:36 +0100 Subject: [PATCH] Fixed bug with sequence --- zcash_primitives/src/transaction/builder.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/zcash_primitives/src/transaction/builder.rs b/zcash_primitives/src/transaction/builder.rs index 8e73839..1e43d63 100644 --- a/zcash_primitives/src/transaction/builder.rs +++ b/zcash_primitives/src/transaction/builder.rs @@ -195,15 +195,19 @@ impl TransparentInputs { // _ => return Err(Error::InvalidAddress), // } - mtx.vin.push(TxIn::new(utxo)); - self.inputs.push(TransparentInputInfo { sk, pubkey, coin, secret, redeem_script }); + let txin = TxIn::new(utxo); // Set lock time if present if (lock_time > 0) { - mtx.sequence = 4294967294; // max value (0xFFFFFFFF - 1), so lockTime can be used but not RBF mtx.lock_time = lock_time; + + // Also set sequence + txin.sequence = std::u32::MAX - 1; // max value (0xFFFFFFFF - 1), so lockTime can be used but not RBF } + mtx.vin.push(txin); + self.inputs.push(TransparentInputInfo { sk, pubkey, coin, secret, redeem_script }); + Ok(()) }