diff --git a/zebra-network/src/protocol/external/codec.rs b/zebra-network/src/protocol/external/codec.rs index 9006701b7..e18417c3d 100644 --- a/zebra-network/src/protocol/external/codec.rs +++ b/zebra-network/src/protocol/external/codec.rs @@ -203,13 +203,7 @@ impl Codec { } Addr(ref addrs) => addrs.zcash_serialize(&mut writer)?, GetAddr => { /* Empty payload -- no-op */ } - Block { - ref version, - ref block, - } => { - writer.write_u32::(version.0)?; - block.zcash_serialize(&mut writer)? - } + Block(ref block) => block.zcash_serialize(&mut writer)?, GetBlocks { ref version, ref block_locator_hashes, @@ -232,13 +226,7 @@ impl Codec { Inv(ref hashes) => hashes.zcash_serialize(&mut writer)?, GetData(ref hashes) => hashes.zcash_serialize(&mut writer)?, NotFound(ref hashes) => hashes.zcash_serialize(&mut writer)?, - Tx { - ref version, - ref transaction, - } => { - writer.write_u32::(version.0)?; - transaction.zcash_serialize(&mut writer)? - } + Tx(ref transaction) => transaction.zcash_serialize(&mut writer)?, Mempool => { /* Empty payload -- no-op */ } FilterLoad { ref filter, @@ -465,10 +453,7 @@ impl Codec { } fn read_block(&self, mut reader: R) -> Result { - Ok(Message::Block { - version: Version(reader.read_u32::()?), - block: Box::new(Block::zcash_deserialize(&mut reader)?), - }) + Ok(Message::Block(Box::new(Block::zcash_deserialize(reader)?))) } fn read_getblocks(&self, mut reader: R) -> Result { @@ -508,11 +493,8 @@ impl Codec { Ok(Message::NotFound(Vec::zcash_deserialize(reader)?)) } - fn read_tx(&self, mut reader: R) -> Result { - Ok(Message::Tx { - version: Version(reader.read_u32::()?), - transaction: Box::new(Transaction::zcash_deserialize(&mut reader)?), - }) + fn read_tx(&self, mut rdr: R) -> Result { + Ok(Message::Tx(Box::new(Transaction::zcash_deserialize(rdr)?))) } fn read_mempool(&self, mut _reader: R) -> Result { diff --git a/zebra-network/src/protocol/external/message.rs b/zebra-network/src/protocol/external/message.rs index 12b72be1a..29809aec4 100644 --- a/zebra-network/src/protocol/external/message.rs +++ b/zebra-network/src/protocol/external/message.rs @@ -132,14 +132,7 @@ pub enum Message { /// A `block` message. /// /// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#block) - Block { - /// Transaction data format version (note, this is signed). - // XXX does this get folded into the Block struct? - version: Version, - - /// The block itself. - block: Box, - }, + Block(Box), /// A `getblocks` message. /// @@ -252,16 +245,7 @@ pub enum Message { /// A `tx` message. /// /// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#tx) - // `flag` is not included (it's optional), and therefore - // `tx_witnesses` aren't either, as they go if `flag` goes. - Tx { - /// Transaction data format version (note, this is signed). - // XXX do we still need this with the transaction data handling? - version: Version, - - /// The `Transaction` type itself. - transaction: Box, - }, + Tx(Box), /// A `mempool` message. ///