]> Untitled Git - bdk/commitdiff
types: Make Utxo::Foreign::sequence not optional
authorSteven Roose <steven@stevenroose.org>
Tue, 12 Nov 2024 19:24:19 +0000 (16:24 -0300)
committerSteve Myers <steve@notmandatory.org>
Thu, 21 Nov 2024 03:07:58 +0000 (21:07 -0600)
It's never kept internally as optional at this point.

crates/wallet/src/types.rs
crates/wallet/src/wallet/mod.rs
crates/wallet/src/wallet/tx_builder.rs

index c4626fbf30ed5497674cb61d0d7c0347320e8bf8..54ddfa261aa4768d49666a297179942dc7788da4 100644 (file)
@@ -87,7 +87,7 @@ pub enum Utxo {
         /// The location of the output.
         outpoint: OutPoint,
         /// The nSequence value to set for this input.
-        sequence: Option<Sequence>,
+        sequence: Sequence,
         /// The information about the input we require to add it to a PSBT.
         // Box it to stop the type being too big.
         psbt_input: Box<psbt::Input>,
@@ -129,7 +129,7 @@ impl Utxo {
     pub fn sequence(&self) -> Option<Sequence> {
         match self {
             Utxo::Local(_) => None,
-            Utxo::Foreign { sequence, .. } => *sequence,
+            Utxo::Foreign { sequence, .. } => Some(*sequence),
         }
     }
 }
index 68d5e6bec28cc44ec6cb0f35d68d2c68e8877552..701c3dc26ec82a40f0f420b9840d788d1f9a33d5 100644 (file)
@@ -1653,7 +1653,7 @@ impl Wallet {
                         WeightedUtxo {
                             utxo: Utxo::Foreign {
                                 outpoint: txin.previous_output,
-                                sequence: Some(txin.sequence),
+                                sequence: txin.sequence,
                                 psbt_input: Box::new(psbt::Input {
                                     witness_utxo: Some(txout.clone()),
                                     non_witness_utxo: Some(prev_tx.as_ref().clone()),
index 343734a8df35b26559eb7743931e0bb208b0524d..49f3c19d153ce944baf0b4367aea6803411d03e7 100644 (file)
@@ -408,7 +408,7 @@ impl<'a, Cs> TxBuilder<'a, Cs> {
             satisfaction_weight,
             utxo: Utxo::Foreign {
                 outpoint,
-                sequence: Some(sequence),
+                sequence,
                 psbt_input: Box::new(psbt_input),
             },
         });