From 80a28b9b72acef3e3c65f7312454b2a258905ade Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Sun, 24 Apr 2016 23:12:49 +0200 Subject: [PATCH] fixed encoding 0u8 (#992) * fixed encoding 0u8 * simplified if else stmt --- util/src/rlp/rlpstream.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/util/src/rlp/rlpstream.rs b/util/src/rlp/rlpstream.rs index 7bf3d3cdd..c2ff88c41 100644 --- a/util/src/rlp/rlpstream.rs +++ b/util/src/rlp/rlpstream.rs @@ -307,10 +307,14 @@ struct EncodableU8 (u8); impl ByteEncodable for EncodableU8 { fn to_bytes>(&self, out: &mut V) { - out.vec_push(self.0) + if self.0 != 0 { + out.vec_push(self.0) + } } - fn bytes_len(&self) -> usize { 1 } + fn bytes_len(&self) -> usize { + match self.0 { 0 => 0, _ => 1 } + } } impl RlpEncodable for u8 {