From a45d17257aec6cb1091fd1301dc3243e51d068c5 Mon Sep 17 00:00:00 2001 From: Ignotus Peverell Date: Fri, 13 Jul 2018 00:55:21 +0100 Subject: [PATCH] Cleanup ping-pong serialization --- p2p/src/msg.rs | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/p2p/src/msg.rs b/p2p/src/msg.rs index 32752ff6..6b836da8 100644 --- a/p2p/src/msg.rs +++ b/p2p/src/msg.rs @@ -626,15 +626,8 @@ impl Writeable for Ping { impl Readable for Ping { fn read(reader: &mut Reader) -> Result { - // TODO - once everyone is sending total_difficulty we can clean this up - let total_difficulty = match Difficulty::read(reader) { - Ok(diff) => diff, - Err(_) => Difficulty::zero(), - }; - let height = match reader.read_u64() { - Ok(h) => h, - Err(_) => 0, - }; + let total_difficulty = Difficulty::read(reader)?; + let height = reader.read_u64()?; Ok(Ping { total_difficulty, height, @@ -660,15 +653,8 @@ impl Writeable for Pong { impl Readable for Pong { fn read(reader: &mut Reader) -> Result { - // TODO - once everyone is sending total_difficulty we can clean this up - let total_difficulty = match Difficulty::read(reader) { - Ok(diff) => diff, - Err(_) => Difficulty::zero(), - }; - let height = match reader.read_u64() { - Ok(h) => h, - Err(_) => 0, - }; + let total_difficulty = Difficulty::read(reader)?; + let height = reader.read_u64()?; Ok(Pong { total_difficulty, height,