-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ignore extra data in discv4 messages (#110)
**Motivation** According to the spec: > Implementations should ignore any additional elements in the `packet-data` list as well as any extra data after the list. We're currently failing if any of that happens. **Description** This PR introduces `Decoder::finish_unchecked`, which ignores any trailing bytes instead of failing, and uses that to allow for additional elements inside the packet-data. Also, it replaces some usage of `RLPDecode::decode` with `RLPDecode::decode_unfinished` to allow for extra data after the message. As an extra, it refactors out the big `match` inside of both `Message` encode and decode functions, since it's expected those will change often in the next PRs. Related to #17
- Loading branch information
1 parent
449bc51
commit eaeb9ce
Showing
3 changed files
with
51 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters