From 446c9af560375b1cb8db412bba64a43c1f226258 Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Thu, 1 Jun 2023 13:20:44 +0200 Subject: [PATCH] fix(fundamentals): fix the sized read from wire Signed-off-by: Vincenzo Palazzo --- fundamentals/src/types.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/fundamentals/src/types.rs b/fundamentals/src/types.rs index 48b39cc..5cc4635 100644 --- a/fundamentals/src/types.rs +++ b/fundamentals/src/types.rs @@ -40,15 +40,7 @@ macro_rules! to_wire_type_with_size { impl FromWire for $ty { fn from_wire(reader: &mut R) -> std::io::Result { let mut buff = [0; $size]; - let size = reader.read(&mut buff)?; - if size == 0 { - return error!("EOS"); - } - assert_eq!( - size, $size, - "written size {size} is not the given one {}", - $size - ); + reader.read_exact(&mut buff)?; Ok(buff) } }