From 0eaf45ca812b0787bc9bfbceaf1ce223001d384e Mon Sep 17 00:00:00 2001 From: Riccardo Casatta Date: Wed, 18 Nov 2020 10:48:29 +0100 Subject: [PATCH] Use boxed sliced instead of Vec in InvalidPreimageHashPair variant --- src/util/psbt/error.rs | 4 ++-- src/util/psbt/map/input.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/psbt/error.rs b/src/util/psbt/error.rs index b1fd7337..b5dd63f9 100644 --- a/src/util/psbt/error.rs +++ b/src/util/psbt/error.rs @@ -68,9 +68,9 @@ pub enum Error { /// Hash-type hash_type: PsbtHash, /// Pre-image - preimage: Vec, + preimage: Box<[u8]>, /// Hash value - hash: Vec, + hash: Box<[u8]>, }, /// Data inconsistency/conflicting data during merge procedure MergeConflict(String), diff --git a/src/util/psbt/map/input.rs b/src/util/psbt/map/input.rs index ddcc1f8a..ea6274f5 100644 --- a/src/util/psbt/map/input.rs +++ b/src/util/psbt/map/input.rs @@ -311,8 +311,8 @@ where let val: Vec = Deserialize::deserialize(&raw_value)?; if ::hash(&val) != key_val { return Err(psbt::Error::InvalidPreimageHashPair { - preimage: val, - hash: Vec::from(key_val.borrow()), + preimage: val.into_boxed_slice(), + hash: Box::from(key_val.borrow()), hash_type: hash_type, } .into());