Skip to content

Commit

Permalink
fix max enr size issue
Browse files Browse the repository at this point in the history
  • Loading branch information
armaganyildirak committed Oct 12, 2023
1 parent ff0c21f commit cc5ef2c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,14 @@ impl Message {
}
let mut enr_list_rlp = Vec::<Enr<CombinedKey>>::new();
while !payload.is_empty() {
let enr_rlp = Enr::<CombinedKey>::decode(payload)?;
payload.advance(enr_rlp.size() - 2);
let node_header = Header::decode(&mut &payload[..])?;
if !node_header.list {
return Err(DecoderError::Custom("Invalid format of header"));
}
let enr_rlp = Enr::<CombinedKey>::decode(
&mut &payload[..node_header.payload_length + 2],
)?;
payload.advance(enr_rlp.size());
enr_list_rlp.append(&mut vec![enr_rlp]);
}
if enr_list_rlp.is_empty() {
Expand Down

0 comments on commit cc5ef2c

Please sign in to comment.