@@ -25,7 +25,7 @@ use core::str::FromStr;
2525use bitcoin:: blockdata:: witness:: Witness ;
2626use bitcoin:: hashes:: { hash160, ripemd160, sha256} ;
2727use bitcoin:: util:: { sighash, taproot} ;
28- use bitcoin:: { self , secp256k1, TxOut } ;
28+ use bitcoin:: { self , secp256k1, LockTime , Sequence , TxOut } ;
2929
3030use crate :: miniscript:: context:: NoChecks ;
3131use crate :: miniscript:: ScriptContext ;
@@ -48,8 +48,8 @@ pub struct Interpreter<'txin> {
4848 /// For non-Taproot spends, the scriptCode; for Taproot script-spends, this
4949 /// is the leaf script; for key-spends it is `None`.
5050 script_code : Option < bitcoin:: Script > ,
51- age : u32 ,
52- lock_time : u32 ,
51+ age : Sequence ,
52+ lock_time : LockTime ,
5353}
5454
5555// A type representing functions for checking signatures that accept both
@@ -173,8 +173,8 @@ impl<'txin> Interpreter<'txin> {
173173 spk : & bitcoin:: Script ,
174174 script_sig : & ' txin bitcoin:: Script ,
175175 witness : & ' txin Witness ,
176- age : u32 , // CSV, relative lock time.
177- lock_time : u32 , // CLTV, absolute lock time.
176+ age : Sequence , // CSV, relative lock time.
177+ lock_time : LockTime , // CLTV, absolute lock time.
178178 ) -> Result < Self , Error > {
179179 let ( inner, stack, script_code) = inner:: from_txdata ( spk, script_sig, witness) ?;
180180 Ok ( Interpreter {
@@ -491,12 +491,12 @@ pub enum SatisfiedConstraint {
491491 ///Relative Timelock for CSV.
492492 RelativeTimelock {
493493 /// The value of RelativeTimelock
494- time : u32 ,
494+ n : Sequence ,
495495 } ,
496496 ///Absolute Timelock for CLTV.
497497 AbsoluteTimelock {
498498 /// The value of Absolute timelock
499- time : u32 ,
499+ n : LockTime ,
500500 } ,
501501}
502502
@@ -531,8 +531,8 @@ pub struct Iter<'intp, 'txin: 'intp> {
531531 public_key : Option < & ' intp BitcoinKey > ,
532532 state : Vec < NodeEvaluationState < ' intp > > ,
533533 stack : Stack < ' txin > ,
534- age : u32 ,
535- lock_time : u32 ,
534+ age : Sequence ,
535+ lock_time : LockTime ,
536536 has_errored : bool ,
537537}
538538
@@ -619,7 +619,7 @@ where
619619 Terminal :: After ( ref n) => {
620620 debug_assert_eq ! ( node_state. n_evaluated, 0 ) ;
621621 debug_assert_eq ! ( node_state. n_satisfied, 0 ) ;
622- let res = self . stack . evaluate_after ( n , self . lock_time ) ;
622+ let res = self . stack . evaluate_after ( & n . into ( ) , self . lock_time ) ;
623623 if res. is_some ( ) {
624624 return res;
625625 }
@@ -1094,8 +1094,9 @@ mod tests {
10941094 pks. push ( pk) ;
10951095 der_sigs. push ( sigser) ;
10961096
1097- let keypair = bitcoin:: KeyPair :: from_secret_key ( & secp, sk) ;
1098- x_only_pks. push ( bitcoin:: XOnlyPublicKey :: from_keypair ( & keypair) ) ;
1097+ let keypair = bitcoin:: KeyPair :: from_secret_key ( & secp, & sk) ;
1098+ let ( x_only_pk, _parity) = bitcoin:: XOnlyPublicKey :: from_keypair ( & keypair) ;
1099+ x_only_pks. push ( x_only_pk) ;
10991100 let schnorr_sig = secp. sign_schnorr_with_aux_rand ( & msg, & keypair, & [ 0u8 ; 32 ] ) ;
11001101 let schnorr_sig = bitcoin:: SchnorrSig {
11011102 sig : schnorr_sig,
@@ -1144,8 +1145,8 @@ mod tests {
11441145 n_evaluated: 0 ,
11451146 n_satisfied: 0 ,
11461147 } ] ,
1147- age : 1002 ,
1148- lock_time : 1002 ,
1148+ age : Sequence :: from_height ( 1002 ) ,
1149+ lock_time : LockTime :: from_height ( 1002 ) . unwrap ( ) ,
11491150 has_errored : false ,
11501151 }
11511152 }
@@ -1208,7 +1209,9 @@ mod tests {
12081209 let after_satisfied: Result < Vec < SatisfiedConstraint > , Error > = constraints. collect ( ) ;
12091210 assert_eq ! (
12101211 after_satisfied. unwrap( ) ,
1211- vec![ SatisfiedConstraint :: AbsoluteTimelock { time: 1000 } ]
1212+ vec![ SatisfiedConstraint :: AbsoluteTimelock {
1213+ n: LockTime :: from_height( 1000 ) . unwrap( )
1214+ } ]
12121215 ) ;
12131216
12141217 //Check Older
@@ -1218,7 +1221,9 @@ mod tests {
12181221 let older_satisfied: Result < Vec < SatisfiedConstraint > , Error > = constraints. collect ( ) ;
12191222 assert_eq ! (
12201223 older_satisfied. unwrap( ) ,
1221- vec![ SatisfiedConstraint :: RelativeTimelock { time: 1000 } ]
1224+ vec![ SatisfiedConstraint :: RelativeTimelock {
1225+ n: Sequence :: from_height( 1000 )
1226+ } ]
12221227 ) ;
12231228
12241229 //Check Sha256
0 commit comments