@@ -25,7 +25,7 @@ use core::str::FromStr;
25
25
use bitcoin:: blockdata:: witness:: Witness ;
26
26
use bitcoin:: hashes:: { hash160, ripemd160, sha256} ;
27
27
use bitcoin:: util:: { sighash, taproot} ;
28
- use bitcoin:: { self , secp256k1, TxOut } ;
28
+ use bitcoin:: { self , secp256k1, LockTime , Sequence , TxOut } ;
29
29
30
30
use crate :: miniscript:: context:: NoChecks ;
31
31
use crate :: miniscript:: ScriptContext ;
@@ -48,8 +48,8 @@ pub struct Interpreter<'txin> {
48
48
/// For non-Taproot spends, the scriptCode; for Taproot script-spends, this
49
49
/// is the leaf script; for key-spends it is `None`.
50
50
script_code : Option < bitcoin:: Script > ,
51
- age : u32 ,
52
- lock_time : u32 ,
51
+ age : Sequence ,
52
+ lock_time : LockTime ,
53
53
}
54
54
55
55
// A type representing functions for checking signatures that accept both
@@ -173,8 +173,8 @@ impl<'txin> Interpreter<'txin> {
173
173
spk : & bitcoin:: Script ,
174
174
script_sig : & ' txin bitcoin:: Script ,
175
175
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.
178
178
) -> Result < Self , Error > {
179
179
let ( inner, stack, script_code) = inner:: from_txdata ( spk, script_sig, witness) ?;
180
180
Ok ( Interpreter {
@@ -491,12 +491,12 @@ pub enum SatisfiedConstraint {
491
491
///Relative Timelock for CSV.
492
492
RelativeTimelock {
493
493
/// The value of RelativeTimelock
494
- time : u32 ,
494
+ n : Sequence ,
495
495
} ,
496
496
///Absolute Timelock for CLTV.
497
497
AbsoluteTimelock {
498
498
/// The value of Absolute timelock
499
- time : u32 ,
499
+ n : LockTime ,
500
500
} ,
501
501
}
502
502
@@ -531,8 +531,8 @@ pub struct Iter<'intp, 'txin: 'intp> {
531
531
public_key : Option < & ' intp BitcoinKey > ,
532
532
state : Vec < NodeEvaluationState < ' intp > > ,
533
533
stack : Stack < ' txin > ,
534
- age : u32 ,
535
- lock_time : u32 ,
534
+ age : Sequence ,
535
+ lock_time : LockTime ,
536
536
has_errored : bool ,
537
537
}
538
538
@@ -619,7 +619,7 @@ where
619
619
Terminal :: After ( ref n) => {
620
620
debug_assert_eq ! ( node_state. n_evaluated, 0 ) ;
621
621
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 ) ;
623
623
if res. is_some ( ) {
624
624
return res;
625
625
}
@@ -1094,8 +1094,9 @@ mod tests {
1094
1094
pks. push ( pk) ;
1095
1095
der_sigs. push ( sigser) ;
1096
1096
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) ;
1099
1100
let schnorr_sig = secp. sign_schnorr_with_aux_rand ( & msg, & keypair, & [ 0u8 ; 32 ] ) ;
1100
1101
let schnorr_sig = bitcoin:: SchnorrSig {
1101
1102
sig : schnorr_sig,
@@ -1144,8 +1145,8 @@ mod tests {
1144
1145
n_evaluated: 0 ,
1145
1146
n_satisfied: 0 ,
1146
1147
} ] ,
1147
- age : 1002 ,
1148
- lock_time : 1002 ,
1148
+ age : Sequence :: from_height ( 1002 ) ,
1149
+ lock_time : LockTime :: from_height ( 1002 ) . unwrap ( ) ,
1149
1150
has_errored : false ,
1150
1151
}
1151
1152
}
@@ -1208,7 +1209,9 @@ mod tests {
1208
1209
let after_satisfied: Result < Vec < SatisfiedConstraint > , Error > = constraints. collect ( ) ;
1209
1210
assert_eq ! (
1210
1211
after_satisfied. unwrap( ) ,
1211
- vec![ SatisfiedConstraint :: AbsoluteTimelock { time: 1000 } ]
1212
+ vec![ SatisfiedConstraint :: AbsoluteTimelock {
1213
+ n: LockTime :: from_height( 1000 ) . unwrap( )
1214
+ } ]
1212
1215
) ;
1213
1216
1214
1217
//Check Older
@@ -1218,7 +1221,9 @@ mod tests {
1218
1221
let older_satisfied: Result < Vec < SatisfiedConstraint > , Error > = constraints. collect ( ) ;
1219
1222
assert_eq ! (
1220
1223
older_satisfied. unwrap( ) ,
1221
- vec![ SatisfiedConstraint :: RelativeTimelock { time: 1000 } ]
1224
+ vec![ SatisfiedConstraint :: RelativeTimelock {
1225
+ n: Sequence :: from_height( 1000 )
1226
+ } ]
1222
1227
) ;
1223
1228
1224
1229
//Check Sha256
0 commit comments