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