From 5d27c157177e86199cc6f6fdd0e0085d5218c7d1 Mon Sep 17 00:00:00 2001 From: sanket1729 Date: Tue, 11 Jan 2022 07:33:06 +0530 Subject: [PATCH] Add Witness::new() I think it is more natural to write Wintess::new() followed by Witness::push() then Witness::default(). In any case, there is no harm in having additional constructors. --- src/blockdata/witness.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/blockdata/witness.rs b/src/blockdata/witness.rs index 75a21c2c..e31a7908 100644 --- a/src/blockdata/witness.rs +++ b/src/blockdata/witness.rs @@ -120,6 +120,12 @@ impl Encodable for Witness { } impl Witness { + + /// Create a new empty [`Witness`] + pub fn new() -> Self { + Witness::default() + } + /// Creates [`Witness`] object from an array of byte-arrays pub fn from_vec(vec: Vec>) -> Self { let witness_elements = vec.len();