@@ -10,7 +10,7 @@ use crate::miniscript::limits::{
10
10
} ;
11
11
use crate :: { script_num_size, MiniscriptKey , Terminal } ;
12
12
13
- /// Helper struct Whether any satisfaction of this fragment contains any timelocks
13
+ /// Timelock information for satisfaction of a fragment.
14
14
#[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Debug , Default , Hash ) ]
15
15
pub struct TimelockInfo {
16
16
/// csv with heights
@@ -54,24 +54,23 @@ impl OpLimits {
54
54
}
55
55
56
56
impl TimelockInfo {
57
- /// Whether the current contains any possible unspendable
58
- /// path
57
+ /// Returns true if the current `TimelockInfo` contains any possible unspendable paths.
59
58
pub fn contains_unspendable_path ( self ) -> bool {
60
59
self . contains_combination
61
60
}
62
61
63
- // handy function for combining `and` timelocks
64
- // This can be operator overloaded in future
62
+ /// Combines two `TimelockInfo` structs setting `contains_combination` if required (logical and).
65
63
pub ( crate ) fn combine_and ( a : Self , b : Self ) -> Self {
66
64
Self :: combine_threshold ( 2 , once ( a) . chain ( once ( b) ) )
67
65
}
68
66
69
- // handy function for combining `or` timelocks
70
- // This can be operator overloaded in future
67
+ /// Combines two `TimelockInfo` structs, does not set `contains_combination` (logical or).
71
68
pub ( crate ) fn combine_or ( a : Self , b : Self ) -> Self {
72
69
Self :: combine_threshold ( 1 , once ( a) . chain ( once ( b) ) )
73
70
}
74
71
72
+ /// Combines `TimelockInfo` structs, if threshold `k` is greater than one we check for
73
+ /// any unspendable path.
75
74
pub ( crate ) fn combine_threshold < I > ( k : usize , sub_timelocks : I ) -> TimelockInfo
76
75
where
77
76
I : IntoIterator < Item = TimelockInfo > ,
0 commit comments