Skip to content

Commit ab439a1

Browse files
committed
Fix pushbytes == [] check
1 parent ec6a013 commit ab439a1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub fn define_pushable(_: TokenStream) -> TokenStream {
192192
Some(instr_result) => match instr_result {
193193
Ok(instr) => match instr {
194194
bitcoin::script::Instruction::PushBytes(push_bytes) => {
195-
if push_bytes.as_bytes() == [] {
195+
if push_bytes.len() == 0 {
196196
check_optimality(::bitcoin::opcodes::all::OP_PUSHBYTES_0, opcode, file, line)
197197
}
198198
},
@@ -231,7 +231,7 @@ pub fn define_pushable(_: TokenStream) -> TokenStream {
231231
bitcoin::script::Instruction::PushBytes(push_bytes) => {
232232
// Seperately handle OP_0 because it is turned into a PushBytes
233233
// struct in the Script instruction
234-
if push_bytes.as_bytes() == [] {
234+
if push_bytes.len() == 0 {
235235
Some((index, ::bitcoin::opcodes::all::OP_PUSHBYTES_0))
236236
} else {
237237
None

src/parse.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ where
164164
Some(instr_result) => match instr_result {
165165
Ok(instr) => match instr {
166166
bitcoin::script::Instruction::PushBytes(push_bytes) => {
167-
if push_bytes.as_bytes() == [] {
167+
if push_bytes.len() == 0 {
168168
pushable::check_optimality(previous_opcode, ::bitcoin::opcodes::all::OP_PUSHBYTES_0, file!(), line!())
169169
}
170170
},
@@ -180,7 +180,7 @@ where
180180
Some(instr_result) => match instr_result {
181181
Ok(instr) => match instr {
182182
bitcoin::script::Instruction::PushBytes(push_bytes) => {
183-
if push_bytes.as_bytes() == [] {
183+
if push_bytes.len() == 0 {
184184
last_opcode = Some(::bitcoin::opcodes::all::OP_PUSHBYTES_0);
185185
}
186186
},

0 commit comments

Comments
 (0)