@@ -13,7 +13,7 @@ use crate::{script_num_size, MiniscriptKey, Terminal};
1313
1414/// Helper struct Whether any satisfaction of this fragment contains any timelocks
1515#[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Debug , Default , Hash ) ]
16- pub struct TimeLockInfo {
16+ pub struct TimelockInfo {
1717 /// csv with heights
1818 pub csv_with_height : bool ,
1919 /// csv with times
@@ -54,7 +54,7 @@ impl OpLimits {
5454 }
5555}
5656
57- impl TimeLockInfo {
57+ impl TimelockInfo {
5858 /// Whether the current contains any possible unspendable
5959 /// path
6060 pub fn contains_unspendable_path ( self ) -> bool {
@@ -73,9 +73,9 @@ impl TimeLockInfo {
7373 Self :: combine_threshold ( 1 , once ( a) . chain ( once ( b) ) )
7474 }
7575
76- pub ( crate ) fn combine_threshold < I > ( k : usize , sub_timelocks : I ) -> TimeLockInfo
76+ pub ( crate ) fn combine_threshold < I > ( k : usize , sub_timelocks : I ) -> TimelockInfo
7777 where
78- I : IntoIterator < Item = TimeLockInfo > ,
78+ I : IntoIterator < Item = TimelockInfo > ,
7979 {
8080 // timelocks calculation
8181 // Propagate all fields of `TimelockInfo` from each of the node's children to the node
@@ -86,7 +86,7 @@ impl TimeLockInfo {
8686 // If `k > 1` we have the additional consideration that if any two children have conflicting
8787 // timelock requirements, this represents an inaccessible spending branch.
8888 sub_timelocks. into_iter ( ) . fold (
89- TimeLockInfo :: default ( ) ,
89+ TimelockInfo :: default ( ) ,
9090 |mut timelock_info, sub_timelock| {
9191 // If more than one branch may be taken, and some other branch has a requirement
9292 // that conflicts with this one, set `contains_combination`
@@ -131,7 +131,7 @@ pub struct ExtData {
131131 /// the cost for the witness stack, the second one is the cost for scriptSig.
132132 pub max_dissat_size : Option < ( usize , usize ) > ,
133133 /// The timelock info about heightlocks and timelocks
134- pub timelock_info : TimeLockInfo ,
134+ pub timelock_info : TimelockInfo ,
135135 /// Maximum stack + alt stack size during satisfaction execution
136136 /// This does **not** include initial witness elements. This element only captures
137137 /// the additional elements that are pushed during execution.
@@ -163,7 +163,7 @@ impl Property for ExtData {
163163 stack_elem_count_dissat : None ,
164164 max_sat_size : Some ( ( 0 , 0 ) ) ,
165165 max_dissat_size : None ,
166- timelock_info : TimeLockInfo :: default ( ) ,
166+ timelock_info : TimelockInfo :: default ( ) ,
167167 exec_stack_elem_count_sat : Some ( 1 ) ,
168168 exec_stack_elem_count_dissat : None ,
169169 }
@@ -178,7 +178,7 @@ impl Property for ExtData {
178178 stack_elem_count_dissat : Some ( 0 ) ,
179179 max_sat_size : None ,
180180 max_dissat_size : Some ( ( 0 , 0 ) ) ,
181- timelock_info : TimeLockInfo :: default ( ) ,
181+ timelock_info : TimelockInfo :: default ( ) ,
182182 exec_stack_elem_count_sat : None ,
183183 exec_stack_elem_count_dissat : Some ( 1 ) ,
184184 }
@@ -199,7 +199,7 @@ impl Property for ExtData {
199199 SigType :: Schnorr => Some ( ( 66 , 66 ) ) ,
200200 } ,
201201 max_dissat_size : Some ( ( 1 , 1 ) ) ,
202- timelock_info : TimeLockInfo :: default ( ) ,
202+ timelock_info : TimelockInfo :: default ( ) ,
203203 exec_stack_elem_count_sat : Some ( 1 ) , // pushes the pk
204204 exec_stack_elem_count_dissat : Some ( 1 ) ,
205205 }
@@ -220,7 +220,7 @@ impl Property for ExtData {
220220 SigType :: Ecdsa => Some ( ( 35 , 35 ) ) ,
221221 SigType :: Schnorr => Some ( ( 34 , 34 ) ) ,
222222 } ,
223- timelock_info : TimeLockInfo :: default ( ) ,
223+ timelock_info : TimelockInfo :: default ( ) ,
224224 exec_stack_elem_count_sat : Some ( 2 ) , // dup and hash push
225225 exec_stack_elem_count_dissat : Some ( 2 ) ,
226226 }
@@ -243,7 +243,7 @@ impl Property for ExtData {
243243 stack_elem_count_dissat : Some ( k + 1 ) ,
244244 max_sat_size : Some ( ( 1 + 73 * k, 1 + 73 * k) ) ,
245245 max_dissat_size : Some ( ( 1 + k, 1 + k) ) ,
246- timelock_info : TimeLockInfo :: default ( ) ,
246+ timelock_info : TimelockInfo :: default ( ) ,
247247 exec_stack_elem_count_sat : Some ( n) , // n pks
248248 exec_stack_elem_count_dissat : Some ( n) ,
249249 }
@@ -265,7 +265,7 @@ impl Property for ExtData {
265265 stack_elem_count_dissat : Some ( n) ,
266266 max_sat_size : Some ( ( ( n - k) + 66 * k, ( n - k) + 66 * k) ) ,
267267 max_dissat_size : Some ( ( n, n) ) ,
268- timelock_info : TimeLockInfo :: default ( ) ,
268+ timelock_info : TimelockInfo :: default ( ) ,
269269 exec_stack_elem_count_sat : Some ( 2 ) , // the two nums before num equal verify
270270 exec_stack_elem_count_dissat : Some ( 2 ) ,
271271 }
@@ -285,7 +285,7 @@ impl Property for ExtData {
285285 stack_elem_count_dissat : Some ( 1 ) ,
286286 max_sat_size : Some ( ( 33 , 33 ) ) ,
287287 max_dissat_size : Some ( ( 33 , 33 ) ) ,
288- timelock_info : TimeLockInfo :: default ( ) ,
288+ timelock_info : TimelockInfo :: default ( ) ,
289289 exec_stack_elem_count_sat : Some ( 2 ) , // either size <32> or <hash256> <32 byte>
290290 exec_stack_elem_count_dissat : Some ( 2 ) ,
291291 }
@@ -300,7 +300,7 @@ impl Property for ExtData {
300300 stack_elem_count_dissat : Some ( 1 ) ,
301301 max_sat_size : Some ( ( 33 , 33 ) ) ,
302302 max_dissat_size : Some ( ( 33 , 33 ) ) ,
303- timelock_info : TimeLockInfo :: default ( ) ,
303+ timelock_info : TimelockInfo :: default ( ) ,
304304 exec_stack_elem_count_sat : Some ( 2 ) , // either size <32> or <hash256> <32 byte>
305305 exec_stack_elem_count_dissat : Some ( 2 ) ,
306306 }
@@ -315,7 +315,7 @@ impl Property for ExtData {
315315 stack_elem_count_dissat : Some ( 1 ) ,
316316 max_sat_size : Some ( ( 33 , 33 ) ) ,
317317 max_dissat_size : Some ( ( 33 , 33 ) ) ,
318- timelock_info : TimeLockInfo :: default ( ) ,
318+ timelock_info : TimelockInfo :: default ( ) ,
319319 exec_stack_elem_count_sat : Some ( 2 ) , // either size <32> or <hash256> <20 byte>
320320 exec_stack_elem_count_dissat : Some ( 2 ) ,
321321 }
@@ -330,7 +330,7 @@ impl Property for ExtData {
330330 stack_elem_count_dissat : Some ( 1 ) ,
331331 max_sat_size : Some ( ( 33 , 33 ) ) ,
332332 max_dissat_size : Some ( ( 33 , 33 ) ) ,
333- timelock_info : TimeLockInfo :: default ( ) ,
333+ timelock_info : TimelockInfo :: default ( ) ,
334334 exec_stack_elem_count_sat : Some ( 2 ) , // either size <32> or <hash256> <20 byte>
335335 exec_stack_elem_count_dissat : Some ( 2 ) ,
336336 }
@@ -349,7 +349,7 @@ impl Property for ExtData {
349349 stack_elem_count_dissat : None ,
350350 max_sat_size : Some ( ( 0 , 0 ) ) ,
351351 max_dissat_size : None ,
352- timelock_info : TimeLockInfo {
352+ timelock_info : TimelockInfo {
353353 csv_with_height : false ,
354354 csv_with_time : false ,
355355 cltv_with_height : t < LOCKTIME_THRESHOLD ,
@@ -370,7 +370,7 @@ impl Property for ExtData {
370370 stack_elem_count_dissat : None ,
371371 max_sat_size : Some ( ( 0 , 0 ) ) ,
372372 max_dissat_size : None ,
373- timelock_info : TimeLockInfo {
373+ timelock_info : TimelockInfo {
374374 csv_with_height : ( t & SEQUENCE_LOCKTIME_TYPE_FLAG ) == 0 ,
375375 csv_with_time : ( t & SEQUENCE_LOCKTIME_TYPE_FLAG ) != 0 ,
376376 cltv_with_height : false ,
@@ -518,7 +518,7 @@ impl Property for ExtData {
518518 max_dissat_size : l
519519 . max_dissat_size
520520 . and_then ( |( lw, ls) | r. max_dissat_size . map ( |( rw, rs) | ( lw + rw, ls + rs) ) ) ,
521- timelock_info : TimeLockInfo :: combine_and ( l. timelock_info , r. timelock_info ) ,
521+ timelock_info : TimelockInfo :: combine_and ( l. timelock_info , r. timelock_info ) ,
522522 // Left element leaves a stack result on the stack top and then right element is evaluated
523523 // Therefore + 1 is added to execution size of second element
524524 exec_stack_elem_count_sat : opt_max (
@@ -549,7 +549,7 @@ impl Property for ExtData {
549549 . max_sat_size
550550 . and_then ( |( lw, ls) | r. max_sat_size . map ( |( rw, rs) | ( lw + rw, ls + rs) ) ) ,
551551 max_dissat_size : None ,
552- timelock_info : TimeLockInfo :: combine_and ( l. timelock_info , r. timelock_info ) ,
552+ timelock_info : TimelockInfo :: combine_and ( l. timelock_info , r. timelock_info ) ,
553553 // [X] leaves no element after evaluation, hence this is the max
554554 exec_stack_elem_count_sat : opt_max (
555555 l. exec_stack_elem_count_sat ,
@@ -589,7 +589,7 @@ impl Property for ExtData {
589589 max_dissat_size : l
590590 . max_dissat_size
591591 . and_then ( |( lw, ls) | r. max_dissat_size . map ( |( rw, rs) | ( lw + rw, ls + rs) ) ) ,
592- timelock_info : TimeLockInfo :: combine_or ( l. timelock_info , r. timelock_info ) ,
592+ timelock_info : TimelockInfo :: combine_or ( l. timelock_info , r. timelock_info ) ,
593593 exec_stack_elem_count_sat : cmp:: max (
594594 opt_max (
595595 l. exec_stack_elem_count_sat ,
@@ -632,7 +632,7 @@ impl Property for ExtData {
632632 max_dissat_size : l
633633 . max_dissat_size
634634 . and_then ( |( lw, ls) | r. max_dissat_size . map ( |( rw, rs) | ( lw + rw, ls + rs) ) ) ,
635- timelock_info : TimeLockInfo :: combine_or ( l. timelock_info , r. timelock_info ) ,
635+ timelock_info : TimelockInfo :: combine_or ( l. timelock_info , r. timelock_info ) ,
636636 exec_stack_elem_count_sat : cmp:: max (
637637 l. exec_stack_elem_count_sat ,
638638 opt_max ( r. exec_stack_elem_count_sat , l. exec_stack_elem_count_dissat ) ,
@@ -666,7 +666,7 @@ impl Property for ExtData {
666666 . and_then ( |( lw, ls) | r. max_sat_size . map ( |( rw, rs) | ( lw + rw, ls + rs) ) ) ,
667667 ) ,
668668 max_dissat_size : None ,
669- timelock_info : TimeLockInfo :: combine_or ( l. timelock_info , r. timelock_info ) ,
669+ timelock_info : TimelockInfo :: combine_or ( l. timelock_info , r. timelock_info ) ,
670670 exec_stack_elem_count_sat : cmp:: max (
671671 l. exec_stack_elem_count_sat ,
672672 opt_max ( r. exec_stack_elem_count_sat , l. exec_stack_elem_count_dissat ) ,
@@ -709,7 +709,7 @@ impl Property for ExtData {
709709 ( Some ( l) , None ) => Some ( ( 2 + l. 0 , 1 + l. 1 ) ) ,
710710 ( None , None ) => None ,
711711 } ,
712- timelock_info : TimeLockInfo :: combine_or ( l. timelock_info , r. timelock_info ) ,
712+ timelock_info : TimelockInfo :: combine_or ( l. timelock_info , r. timelock_info ) ,
713713 // TODO: fix elem count dissat bug
714714 exec_stack_elem_count_sat : cmp:: max (
715715 l. exec_stack_elem_count_sat ,
@@ -752,8 +752,8 @@ impl Property for ExtData {
752752 max_dissat_size : a
753753 . max_dissat_size
754754 . and_then ( |( wa, sa) | c. max_dissat_size . map ( |( wc, sc) | ( wa + wc, sa + sc) ) ) ,
755- timelock_info : TimeLockInfo :: combine_or (
756- TimeLockInfo :: combine_and ( a. timelock_info , b. timelock_info ) ,
755+ timelock_info : TimelockInfo :: combine_or (
756+ TimelockInfo :: combine_and ( a. timelock_info , b. timelock_info ) ,
757757 c. timelock_info ,
758758 ) ,
759759 exec_stack_elem_count_sat : cmp:: max (
@@ -884,7 +884,7 @@ impl Property for ExtData {
884884 stack_elem_count_dissat,
885885 max_sat_size,
886886 max_dissat_size,
887- timelock_info : TimeLockInfo :: combine_threshold ( k, timelocks) ,
887+ timelock_info : TimelockInfo :: combine_threshold ( k, timelocks) ,
888888 exec_stack_elem_count_sat,
889889 exec_stack_elem_count_dissat,
890890 } )
0 commit comments