Skip to content

Commit 6af7b0c

Browse files
committed
Improve docs on TimelockInfo
1 parent 70db460 commit 6af7b0c

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
@@ -10,7 +10,7 @@ use crate::miniscript::limits::{
1010
};
1111
use crate::{script_num_size, MiniscriptKey, Terminal};
1212

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

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

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

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

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

0 commit comments

Comments
 (0)