Remove unused impl ZcashDeserialize for Height (#6139)

This commit is contained in:
teor 2023-02-11 06:24:46 +10:00 committed by GitHub
parent fc955152b7
commit a8370a8eda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 20 deletions

View File

@ -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<i32> for Height {
}
}
impl ZcashDeserialize for Height {
fn zcash_deserialize<R: io::Read>(mut reader: R) -> Result<Self, SerializationError> {
let height = reader.read_u32::<LittleEndian>()?;
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();