diff --git a/documents/Cargo.toml b/documents/Cargo.toml index 2224f7a831af8c8dd36d805f57a098cc294eadc3..de28ba5ffb6f71c5b8f200a0b9aed21e7b33a34a 100644 --- a/documents/Cargo.toml +++ b/documents/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "duniter-documents" -version = "0.7.0" +version = "0.7.1" authors = ["nanocryk <nanocryk@duniter.org>", "elois <elois@ifee.fr>"] description = "Handles Duniter documents" repository = "https://git.duniter.org/nodes/rust/duniter-rs" diff --git a/documents/lib.rs b/documents/lib.rs index d445c12f94a8f699c25d279c25c11b8896cf7a30..702879a4d0b2915cc92bb87e4f198531e7e34ebf 100644 --- a/documents/lib.rs +++ b/documents/lib.rs @@ -63,6 +63,13 @@ impl Debug for Hash { } } +impl Default for Hash { + fn default() -> Hash { + let default: [u8; 32] = [0; 32]; + Hash(default) + } +} + impl Hash { /// Convert a `Hash` to an hex string. pub fn to_hex(&self) -> String { @@ -168,6 +175,15 @@ impl Debug for Blockstamp { } } +impl Default for Blockstamp { + fn default() -> Blockstamp { + Blockstamp { + id: BlockId(0), + hash: BlockHash(Hash::default()), + } + } +} + impl Blockstamp { /// Create a `BlockUId` from a text. pub fn from_string(src: &str) -> Result<Blockstamp, BlockUIdParseError> {