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.
This commit is contained in:
sanket1729 2022-01-11 07:33:06 +05:30
parent 0e2e559712
commit 5d27c15717
1 changed files with 6 additions and 0 deletions

View File

@ -120,6 +120,12 @@ impl Encodable for Witness {
} }
impl Witness { impl Witness {
/// Create a new empty [`Witness`]
pub fn new() -> Self {
Witness::default()
}
/// Creates [`Witness`] object from an array of byte-arrays /// Creates [`Witness`] object from an array of byte-arrays
pub fn from_vec(vec: Vec<Vec<u8>>) -> Self { pub fn from_vec(vec: Vec<Vec<u8>>) -> Self {
let witness_elements = vec.len(); let witness_elements = vec.len();