Skip to content

Commit b0151f3

Browse files
committed
Refactor check_timelocks helper
Rename the helper function and local variable at its call site to better describe the functionality. Refactor only, no logic changes.
1 parent 19ee6fe commit b0151f3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/policy/concrete.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -700,17 +700,21 @@ impl<Pk: MiniscriptKey> Policy<Pk> {
700700
/// Returns an error if there is at least one satisfaction that contains
701701
/// a combination of heightlock and timelock.
702702
pub fn check_timelocks(&self) -> Result<(), PolicyError> {
703-
let timelocks = self.check_timelocks_helper();
704-
if timelocks.contains_combination {
703+
let aggregated_timelock_info = self.timelock_info();
704+
if aggregated_timelock_info.contains_combination {
705705
Err(PolicyError::HeightTimelockCombination)
706706
} else {
707707
Ok(())
708708
}
709709
}
710710

711-
// Checks whether the given concrete policy contains a combination of
712-
// timelocks and heightlocks
713-
fn check_timelocks_helper(&self) -> TimelockInfo {
711+
/// Processes `Policy` using `post_order_iter`, creates a `TimelockInfo` for each `Nullary` node
712+
/// and combines them together for `Nary` nodes.
713+
///
714+
/// # Returns
715+
///
716+
/// A single `TimelockInfo` that is the combination of all others after processing each node.
717+
fn timelock_info(&self) -> TimelockInfo {
714718
use Policy::*;
715719

716720
let mut infos = vec![];

0 commit comments

Comments
 (0)