Skip to content

Commit 1efc7a3

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 4749931 commit 1efc7a3

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
@@ -685,17 +685,21 @@ impl<Pk: MiniscriptKey> Policy<Pk> {
685685
/// Returns an error if there is at least one satisfaction that contains
686686
/// a combination of heightlock and timelock.
687687
pub fn check_timelocks(&self) -> Result<(), PolicyError> {
688-
let timelocks = self.check_timelocks_helper();
689-
if timelocks.contains_combination {
688+
let aggregated_timelock_info = self.timelock_info();
689+
if aggregated_timelock_info.contains_combination {
690690
Err(PolicyError::HeightTimelockCombination)
691691
} else {
692692
Ok(())
693693
}
694694
}
695695

696-
// Checks whether the given concrete policy contains a combination of
697-
// timelocks and heightlocks
698-
fn check_timelocks_helper(&self) -> TimelockInfo {
696+
/// Processes `Policy` using `post_order_iter`, creates a `TimelockInfo` for each `Nullary` node
697+
/// and combines them together for `Nary` nodes.
698+
///
699+
/// # Returns
700+
///
701+
/// A single `TimelockInfo` that is the combination of all others after processing each node.
702+
fn timelock_info(&self) -> TimelockInfo {
699703
use Policy::*;
700704

701705
let mut infos = vec![];

0 commit comments

Comments
 (0)