Skip to content

Commit f145ac0

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 d45efc6 commit f145ac0

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
@@ -695,17 +695,21 @@ impl<Pk: MiniscriptKey> Policy<Pk> {
695695
/// Returns an error if there is at least one satisfaction that contains
696696
/// a combination of heightlock and timelock.
697697
pub fn check_timelocks(&self) -> Result<(), PolicyError> {
698-
let timelocks = self.check_timelocks_helper();
699-
if timelocks.contains_combination {
698+
let aggregated_timelock_info = self.timelock_info();
699+
if aggregated_timelock_info.contains_combination {
700700
Err(PolicyError::HeightTimelockCombination)
701701
} else {
702702
Ok(())
703703
}
704704
}
705705

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

711715
let mut infos = vec![];

0 commit comments

Comments
 (0)