From a9d2ce71505bd50b98ebb6278b9ecdd7e5420f56 Mon Sep 17 00:00:00 2001 From: NikVolf Date: Sat, 7 Sep 2019 18:15:18 +0300 Subject: [PATCH] from_bytes for NodeData --- src/node_data.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/node_data.rs b/src/node_data.rs index 59591e5..fd01c3a 100644 --- a/src/node_data.rs +++ b/src/node_data.rs @@ -153,4 +153,9 @@ impl NodeData { buf[0..pos].to_vec() } + + pub fn from_bytes(consensus_branch_id: u32, buf: &[u8]) -> std::io::Result { + let mut cursor = std::io::Cursor::new(buf); + Self::read(consensus_branch_id, &mut cursor) + } } \ No newline at end of file