diff --git a/src/blockdata/script.rs b/src/blockdata/script.rs index 4e3151cd..6686c06b 100644 --- a/src/blockdata/script.rs +++ b/src/blockdata/script.rs @@ -524,7 +524,7 @@ impl Script { // special meaning. The value of the first push is called the "version byte". The following // byte vector pushed is called the "witness program". let script_len = self.0.len(); - if script_len < 4 || script_len > 42 { + if !(4..=42).contains(&script_len) { return false } let ver_opcode = opcodes::All::from(self.0[0]); // Version 0 or PUSHNUM_1-PUSHNUM_16 @@ -876,7 +876,7 @@ impl Builder { /// dedicated opcodes to push some small integers. pub fn push_int(self, data: i64) -> Builder { // We can special-case -1, 1-16 - if data == -1 || (data >= 1 && data <= 16) { + if data == -1 || (1..=16).contains(&data) { let opcode = opcodes::All::from( (data - 1 + opcodes::OP_TRUE.into_u8() as i64) as u8 );