From 17f26ad58836e80bcc58e4d2eb3a41b7c22f4d17 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Sun, 17 Apr 2016 18:30:42 +0300 Subject: [PATCH] finished for BlockLocation --- ethcore/src/blockchain/block_info.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ethcore/src/blockchain/block_info.rs b/ethcore/src/blockchain/block_info.rs index 28d3c8971..eb3677c25 100644 --- a/ethcore/src/blockchain/block_info.rs +++ b/ethcore/src/blockchain/block_info.rs @@ -80,3 +80,17 @@ impl ToBytesWithMap for BranchBecomingCanonChainData { (&self.enacted, &self.retracted, &self.ancestor).to_bytes_map() } } + +impl ToBytesWithMap for BlockLocation { + fn to_bytes_map(&self) -> Vec { + match *self { + BlockLocation::CanonChain => vec![0u8], + BlockLocation::Branch => vec![1u8], + BlockLocation::BranchBecomingCanonChain(ref data) => { + let mut bytes = (&data.enacted, &data.retracted, &data.ancestor).to_bytes_map(); + bytes.insert(0, 2u8); + bytes + } + } + } +}