diff --git a/primitives/src/witness.rs b/primitives/src/witness.rs index e62b79833..a00e98653 100644 --- a/primitives/src/witness.rs +++ b/primitives/src/witness.rs @@ -221,7 +221,7 @@ impl Witness { Some(&slice[..end]) } - /// Creates a new witness from a list of hex strings. + /// Constructs a new witness from a list of hex strings. /// /// # Errors /// @@ -232,7 +232,11 @@ impl Witness { I: IntoIterator, T: AsRef, { - let result: Vec> = iter.into_iter().map(|hex_str| Vec::from_hex(hex_str.as_ref())).collect::, _>>()?; + let result = iter + .into_iter() + .map(|hex_str| Vec::from_hex(hex_str.as_ref())) + .collect::, _>>()?; + Ok(Self::from_slice(&result)) } }