Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions bitcoin/src/blockdata/script/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ impl Builder {
match bytes[0] {
0x81 => self.push_opcode(OP_PUSHNUM_NEG1),
0 => self.push_opcode(OP_PUSHBYTES_0),
1..=16 => {
self.push_opcode(Opcode::from(bytes[0] + (OP_PUSHNUM_1.to_u8() - 1)))
}
1..=16 => self.push_opcode(Opcode::from(bytes[0] + (OP_PUSHNUM_1.to_u8() - 1))),
_ => self, // unreachable arm
}
} else {
Expand All @@ -99,10 +97,7 @@ impl Builder {
/// Standardness rules require push minimality according to [CheckMinimalPush] of core.
///
/// [CheckMinimalPush]: <https://github.com/bitcoin/bitcoin/blob/99a4ddf5ab1b3e514d08b90ad8565827fda7b63b/src/script/script.cpp#L366>
pub fn push_slice_non_minimal<T: AsRef<PushBytes>>(
mut self,
data: T,
) -> Builder {
pub fn push_slice_non_minimal<T: AsRef<PushBytes>>(mut self, data: T) -> Builder {
self.0.push_slice_non_minimal(data);
self.1 = None;
self
Expand Down
2 changes: 1 addition & 1 deletion primitives/src/script/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ mod tests {
assert!(formatted_script.contains("<unexpected end>"));
}

#[test]
#[test]
fn legacy_opcode() {
let script = Script::from_bytes(&[0x03, 0xaa, 0xbb, 0xcc]);
assert_eq!(format!("{}", script), "OP_PUSHBYTES_3 aabbcc");
Expand Down