Skip to content

Commit d226076

Browse files
committed
miniscript: remove a redundant check for non-ASCII chars
Signed-off-by: Antoine Poinsot <[email protected]>
1 parent 79d5c06 commit d226076

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/miniscript/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,12 +308,7 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Miniscript<Pk, Ctx> {
308308
<Pk as str::FromStr>::Err: ToString,
309309
<<Pk as MiniscriptKey>::Hash as str::FromStr>::Err: ToString,
310310
{
311-
for ch in s.as_bytes() {
312-
if *ch < 20 || *ch > 127 {
313-
return Err(Error::Unprintable(*ch));
314-
}
315-
}
316-
311+
// This checks for invalid ASCII chars
317312
let top = expression::Tree::from_str(s)?;
318313
let ms: Miniscript<Pk, Ctx> = expression::FromTree::from_tree(&top)?;
319314

@@ -898,4 +893,9 @@ mod tests {
898893
))
899894
.is_err());
900895
}
896+
897+
#[test]
898+
fn non_ascii() {
899+
assert!(Segwitv0Script::from_str_insane("🌏").unwrap_err().to_string().contains("unprintable character"));
900+
}
901901
}

0 commit comments

Comments
 (0)