From d8986098c6003f73536fdfe9d64521e30fa8a845 Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Wed, 9 Oct 2019 21:58:44 -0400 Subject: [PATCH] Add write_body implementations for GetData, NotFound, and a placeholder for Reject --- zebra-network/src/protocol/codec.rs | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/zebra-network/src/protocol/codec.rs b/zebra-network/src/protocol/codec.rs index ed206404..1afb8777 100644 --- a/zebra-network/src/protocol/codec.rs +++ b/zebra-network/src/protocol/codec.rs @@ -198,19 +198,14 @@ impl Codec { Pong(nonce) => { writer.write_u64::(nonce.0)?; } - GetAddr => { /* Empty payload -- no-op */ } + // Reject {} => {} Addr(ref addrs) => { writer.write_compactsize(addrs.len() as u64)?; for addr in addrs { addr.zcash_serialize(&mut writer)?; } } - Inv(ref hashes) => { - writer.write_compactsize(hashes.len() as u64)?; - for hash in hashes { - hash.zcash_serialize(&mut writer)?; - } - } + GetAddr => { /* Empty payload -- no-op */ } Block { ref version, ref block, @@ -250,6 +245,24 @@ impl Codec { header.zcash_serialize(&mut writer)?; } } + Inv(ref hashes) => { + writer.write_compactsize(hashes.len() as u64)?; + for hash in hashes { + hash.zcash_serialize(&mut writer)?; + } + } + GetData(ref hashes) => { + writer.write_compactsize(hashes.len() as u64)?; + for hash in hashes { + hash.zcash_serialize(&mut writer)?; + } + } + NotFound(ref hashes) => { + writer.write_compactsize(hashes.len() as u64)?; + for hash in hashes { + hash.zcash_serialize(&mut writer)?; + } + } Tx { ref version, ref transaction,