From 1342d73734d4a5c92db24396caf0a8dac81e980a Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Thu, 3 Sep 2020 16:51:34 +0200 Subject: [PATCH] Script hash functions with non-allocating serialization --- src/blockdata/script.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/blockdata/script.rs b/src/blockdata/script.rs index cd590470..3d42d741 100644 --- a/src/blockdata/script.rs +++ b/src/blockdata/script.rs @@ -38,7 +38,6 @@ use hashes::Hash; #[cfg(feature="bitcoinconsensus")] use OutPoint; use util::key::PublicKey; -use util::psbt::serialize::Serialize; #[derive(Clone, Default, PartialOrd, Ord, PartialEq, Eq, Hash)] /// A Bitcoin script @@ -278,12 +277,12 @@ impl Script { /// Returns 160-bit hash of the script pub fn script_hash(&self) -> ScriptHash { - ScriptHash::hash(&self.serialize()) + ScriptHash::hash(&self.as_bytes()) } /// Returns 256-bit hash of the script for P2WSH outputs pub fn wscript_hash(&self) -> WScriptHash { - WScriptHash::hash(&self.serialize()) + WScriptHash::hash(&self.as_bytes()) } /// The length in bytes of the script