Skip to content

Commit

Permalink
feat: check policy validity in from_ast to prevent duplicate check
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisCho-H committed Nov 12, 2024
1 parent 39c2fa5 commit 757daee
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/miniscript/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ mod private {
if (res.ext.tree_height as u32) > MAX_RECURSION_DEPTH {
return Err(Error::MaxRecursiveDepthExceeded);
}
Ctx::check_global_consensus_validity(&res)?;
Ctx::check_global_validity(&res)?;
Ok(res)
}

Expand Down Expand Up @@ -742,7 +742,6 @@ where
for ch in frag_wrap.chars().rev() {
// Check whether the wrapper is valid under the current context
let ms = Miniscript::from_ast(unwrapped)?;
Ctx::check_global_validity(&ms)?;
match ch {
'a' => unwrapped = Terminal::Alt(Arc::new(ms)),
's' => unwrapped = Terminal::Swap(Arc::new(ms)),
Expand All @@ -759,7 +758,6 @@ where
}
// Check whether the unwrapped miniscript is valid under the current context
let ms = Miniscript::from_ast(unwrapped)?;
Ctx::check_global_validity(&ms)?;
Ok(ms)
}

Expand Down

0 comments on commit 757daee

Please sign in to comment.