From a8370a8eda81adb2d29518451dc679219d7325c6 Mon Sep 17 00:00:00 2001 From: teor Date: Sat, 11 Feb 2023 06:24:46 +1000 Subject: [PATCH] Remove unused impl ZcashDeserialize for Height (#6139) --- zebra-chain/src/block/height.rs | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/zebra-chain/src/block/height.rs b/zebra-chain/src/block/height.rs index e1da2a65a..c7c968c4a 100644 --- a/zebra-chain/src/block/height.rs +++ b/zebra-chain/src/block/height.rs @@ -1,14 +1,8 @@ //! Block height. -use crate::serialization::{SerializationError, ZcashDeserialize}; +use std::ops::{Add, Sub}; -use byteorder::{LittleEndian, ReadBytesExt}; - -use std::{ - convert::TryFrom, - io, - ops::{Add, Sub}, -}; +use crate::serialization::SerializationError; /// The length of the chain back to the genesis block. /// @@ -19,6 +13,11 @@ use std::{ /// # Invariants /// /// Users should not construct block heights greater than `Height::MAX`. +/// +/// # Consensus +/// +/// There are multiple formats for serializing a height, so we don't implement +/// `ZcashSerialize` or `ZcashDeserialize` for `Height`. #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash, Serialize, Deserialize)] pub struct Height(pub u32); @@ -132,18 +131,6 @@ impl Sub for Height { } } -impl ZcashDeserialize for Height { - fn zcash_deserialize(mut reader: R) -> Result { - let height = reader.read_u32::()?; - - if height > Self::MAX.0 { - return Err(SerializationError::Parse("Height exceeds maximum height")); - } - - Ok(Self(height)) - } -} - #[test] fn operator_tests() { let _init_guard = zebra_test::init();