Skip to content

Commit

Permalink
fix(fundamentals): fix the sized read from wire
Browse files Browse the repository at this point in the history
Signed-off-by: Vincenzo Palazzo <[email protected]>
  • Loading branch information
vincenzopalazzo committed Jun 1, 2023
1 parent bc413bb commit 446c9af
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions fundamentals/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,7 @@ macro_rules! to_wire_type_with_size {
impl FromWire for $ty {
fn from_wire<R: Read>(reader: &mut R) -> std::io::Result<Self> {
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)
}
}
Expand Down

0 comments on commit 446c9af

Please sign in to comment.