Skip to content

Commit

Permalink
Merge pull request ProvableHQ#2772 from AleoHQ/hotfix/block-response
Browse files Browse the repository at this point in the history
Add hotfix for BlockResponse deserialization
  • Loading branch information
howardwu authored Oct 17, 2023
2 parents 38dbedf + 5ad1881 commit 5e3949c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions node/router/messages/src/block_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ impl<N: Network> MessageTrait for BlockResponse<N> {
/// Deserializes the given buffer into a message.
#[inline]
fn deserialize(bytes: BytesMut) -> Result<Self> {
let request = BlockRequest::deserialize(bytes.clone())?;
let blocks = Data::Buffer(bytes.freeze());
let mut reader = bytes.reader();
let start_height = u32::read_le(&mut reader)?;
let end_height = u32::read_le(&mut reader)?;
let request = BlockRequest { start_height, end_height };
let blocks = Data::Buffer(reader.into_inner().freeze());
Ok(Self { request, blocks })
}
}

0 comments on commit 5e3949c

Please sign in to comment.