From 757daee60de7f7f07648998a6517525f74cdc42e Mon Sep 17 00:00:00 2001 From: ChrisCho-H Date: Tue, 12 Nov 2024 18:27:13 +0900 Subject: [PATCH] feat: check policy validity in from_ast to prevent duplicate check --- src/miniscript/mod.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/miniscript/mod.rs b/src/miniscript/mod.rs index 79a9e9d57..c4862a942 100644 --- a/src/miniscript/mod.rs +++ b/src/miniscript/mod.rs @@ -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) } @@ -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)), @@ -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) }