Impl Zcash(De)Serialization for Block

This commit is contained in:
Deirdre Connolly 2020-01-31 23:31:51 -05:00 committed by Deirdre Connolly
parent f5c135ee1b
commit dab99ba861
1 changed files with 9 additions and 4 deletions

View File

@ -163,14 +163,19 @@ pub struct Block {
}
impl ZcashSerialize for Block {
fn zcash_serialize<W: io::Write>(&self, _writer: W) -> Result<(), SerializationError> {
unimplemented!();
fn zcash_serialize<W: io::Write>(&self, mut writer: W) -> Result<(), SerializationError> {
self.header.zcash_serialize(&mut writer)?;
self.transactions.zcash_serialize(&mut writer)?;
Ok(())
}
}
impl ZcashDeserialize for Block {
fn zcash_deserialize<R: io::Read>(_reader: R) -> Result<Self, SerializationError> {
unimplemented!();
fn zcash_deserialize<R: io::Read>(mut reader: R) -> Result<Self, SerializationError> {
Ok(Block {
header: BlockHeader::zcash_deserialize(&mut reader)?,
transactions: Vec::zcash_deserialize(&mut reader)?,
})
}
}