diff --git a/crates/chia-traits/src/streamable.rs b/crates/chia-traits/src/streamable.rs index 6be2dab34..a18c0ba93 100644 --- a/crates/chia-traits/src/streamable.rs +++ b/crates/chia-traits/src/streamable.rs @@ -66,6 +66,14 @@ pub trait Streamable { Err(Error::InputTooLarge) } } + fn from_bytes_ignore_extra_bytes(bytes: &[u8]) -> Result + where + Self: Sized, + { + let mut cursor = Cursor::new(bytes); + let ret = Self::parse::(&mut cursor)?; + Ok(ret) + } fn hash(&self) -> [u8; 32] { let mut ctx = Sha256::new(); self.update_digest(&mut ctx);