Skip to content

Commit 6f3303d

Browse files
committed
Improve docs on TimelockInfo
1 parent b2f6ef0 commit 6f3303d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/miniscript/types/extra_props.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::miniscript::limits::{
1111
};
1212
use crate::{script_num_size, MiniscriptKey, Terminal};
1313

14-
/// Helper struct Whether any satisfaction of this fragment contains any timelocks
14+
/// Timelock information for satisfaction of a fragment.
1515
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Default, Hash)]
1616
pub struct TimelockInfo {
1717
/// csv with heights
@@ -55,24 +55,23 @@ impl OpLimits {
5555
}
5656

5757
impl TimelockInfo {
58-
/// Whether the current contains any possible unspendable
59-
/// path
58+
/// Returns true if the current `TimelockInfo` contains any possible unspendable paths.
6059
pub fn contains_unspendable_path(self) -> bool {
6160
self.contains_combination
6261
}
6362

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).
6664
pub(crate) fn combine_and(a: Self, b: Self) -> Self {
6765
Self::combine_threshold(2, once(a).chain(once(b)))
6866
}
6967

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).
7269
pub(crate) fn combine_or(a: Self, b: Self) -> Self {
7370
Self::combine_threshold(1, once(a).chain(once(b)))
7471
}
7572

73+
/// Combines `TimelockInfo` structs, if threshold `k` is greater than one we check for
74+
/// any unspendable path.
7675
pub(crate) fn combine_threshold<I>(k: usize, sub_timelocks: I) -> TimelockInfo
7776
where
7877
I: IntoIterator<Item = TimelockInfo>,

0 commit comments

Comments
 (0)