Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap MsgHeader in MsgHeaderWrapper for Known/Unknown msg type support #2791

Merged
merged 5 commits into from
May 14, 2019

Conversation

antiochp
Copy link
Member

@antiochp antiochp commented May 1, 2019

Introduce a MsgHeaderWrapper enum with Known and Unknown variants.

  • The Known variant wraps a MsgHeader and we process it as before.
  • The Unknown variant wraps a msg_len and we call read_discard(msg_len) to discard the unwanted bytes from the stream.

If we do encounter an unknown msg type then we do not know how to deserialize it safely.
But we do want to read the bytes (based on msg_len) so we can read any subsequent msg correctly off the stream.

Resolves #2782.

@antiochp antiochp changed the title wrap MsgHeader in MsgHeaderWrapper for Known/Unknown msg type support. Wrap MsgHeader in MsgHeaderWrapper for Known/Unknown msg type support May 1, 2019
p2p/src/msg.rs Outdated Show resolved Hide resolved
p2p/src/msg.rs Show resolved Hide resolved
p2p/src/protocol.rs Outdated Show resolved Hide resolved
p2p/src/msg.rs Show resolved Hide resolved
@antiochp antiochp added this to the 1.1.0 milestone May 13, 2019
@ignopeverell ignopeverell merged commit ff1c551 into mimblewimble:master May 14, 2019
@antiochp antiochp deleted the unexpected_msg_type branch May 15, 2019 11:32
@antiochp antiochp added release notes To be included in release notes (of relevant milestone). and removed release notes To be included in release notes (of relevant milestone). labels Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unknown msg type treated as CorruptedData
3 participants