Fixed bug with sequence

This commit is contained in:
CalDescent
2022-05-18 19:25:36 +01:00
parent 9768e4af78
commit 10c3389f17

View File

@@ -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(())
}