Add write_body implementations for GetData, NotFound, and a placeholder for Reject
This commit is contained in:
parent
483d6584f9
commit
d8986098c6
|
|
@ -198,19 +198,14 @@ impl Codec {
|
||||||
Pong(nonce) => {
|
Pong(nonce) => {
|
||||||
writer.write_u64::<LittleEndian>(nonce.0)?;
|
writer.write_u64::<LittleEndian>(nonce.0)?;
|
||||||
}
|
}
|
||||||
GetAddr => { /* Empty payload -- no-op */ }
|
// Reject {} => {}
|
||||||
Addr(ref addrs) => {
|
Addr(ref addrs) => {
|
||||||
writer.write_compactsize(addrs.len() as u64)?;
|
writer.write_compactsize(addrs.len() as u64)?;
|
||||||
for addr in addrs {
|
for addr in addrs {
|
||||||
addr.zcash_serialize(&mut writer)?;
|
addr.zcash_serialize(&mut writer)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Inv(ref hashes) => {
|
GetAddr => { /* Empty payload -- no-op */ }
|
||||||
writer.write_compactsize(hashes.len() as u64)?;
|
|
||||||
for hash in hashes {
|
|
||||||
hash.zcash_serialize(&mut writer)?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Block {
|
Block {
|
||||||
ref version,
|
ref version,
|
||||||
ref block,
|
ref block,
|
||||||
|
|
@ -250,6 +245,24 @@ impl Codec {
|
||||||
header.zcash_serialize(&mut writer)?;
|
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 {
|
Tx {
|
||||||
ref version,
|
ref version,
|
||||||
ref transaction,
|
ref transaction,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue