diff --git a/bitcoin/src/blockdata/block.rs b/bitcoin/src/blockdata/block.rs index 56b15e217..68c2eae7b 100644 --- a/bitcoin/src/blockdata/block.rs +++ b/bitcoin/src/blockdata/block.rs @@ -19,7 +19,6 @@ use crate::consensus::{encode, Decodable, Encodable, Params}; use crate::internal_macros::{impl_consensus_encoding, impl_hashencode}; use crate::pow::{CompactTarget, Target, Work}; use crate::prelude::*; -use crate::script::PushBytes; use crate::{merkle_tree, VarInt}; hashes::hash_newtype! { @@ -381,7 +380,7 @@ impl Block { match push.map_err(|_| Bip34Error::NotPresent)? { script::Instruction::PushBytes(b) => { // Check that the number is encoded in the minimal way. - let h = PushBytes::read_scriptint(b) + let h = b.read_scriptint() .map_err(|_e| Bip34Error::UnexpectedPush(b.as_bytes().to_vec()))?; if h < 0 { Err(Bip34Error::NegativeHeight) diff --git a/bitcoin/src/blockdata/script/instruction.rs b/bitcoin/src/blockdata/script/instruction.rs index b4b1bcd98..84e907eee 100644 --- a/bitcoin/src/blockdata/script/instruction.rs +++ b/bitcoin/src/blockdata/script/instruction.rs @@ -76,7 +76,7 @@ impl<'a> Instruction<'a> { _ => None, } } - Instruction::PushBytes(bytes) => match PushBytes::read_scriptint(bytes) { + Instruction::PushBytes(bytes) => match bytes.read_scriptint() { Ok(v) => Some(v), _ => None, }, diff --git a/fuzz/fuzz_targets/bitcoin/deserialize_script.rs b/fuzz/fuzz_targets/bitcoin/deserialize_script.rs index c11178f90..1a1f899c3 100644 --- a/fuzz/fuzz_targets/bitcoin/deserialize_script.rs +++ b/fuzz/fuzz_targets/bitcoin/deserialize_script.rs @@ -23,7 +23,7 @@ fn do_test(data: &[u8]) { // reserialized as numbers. (For -1 through 16, this will use special ops; for // others it'll just reserialize them as pushes.) if bytes.len() == 1 && bytes[0] != 0x80 && bytes[0] != 0x00 { - if let Ok(num) = script::PushBytes::read_scriptint(bytes) { + if let Ok(num) = bytes.read_scriptint() { b = b.push_int(num); } else { b = b.push_slice(bytes);