Skip to content

Commit

Permalink
Merge pull request #9 from lnspec-tools/macros/fix_fixed_read
Browse files Browse the repository at this point in the history
fix(fundamentals): fix the sized read from wire
  • Loading branch information
vincenzopalazzo authored Jun 3, 2023
2 parents bc413bb + 446c9af commit 4dc8f5e
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 4dc8f5e

Please sign in to comment.