-
Notifications
You must be signed in to change notification settings - Fork 104
Fix P2PClient parsing unknown messages #2315
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
Fix P2PClient parsing unknown messages #2315
Conversation
28abbc3 to
4823b17
Compare
| loop(newRemainingBytes, message :: accum) | ||
| case Failure(_) => | ||
| // Can't parse message yet, we need to wait for more bytes | ||
| (accum.reverse, remainingBytes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why accum.reverse?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, never mind
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although if we change accum type to Vector we could simply append new messages, and wouldn't need reverse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to use Vector and removed the reverses
4823b17 to
03024f2
Compare
|
Tested 03024f2 by syncing a few thousand blocks on testnet, everything worked fine. |
* Fix P2PClient parsing unknown messages * Use Vector, calculate correct checksum
I tried syncing my node with the latest release candidate of Bitcoin Core and found it wouldn't sync.
The error was that it wasn't able to parse the new P2P messages introduced. This fixes that by checking if it's an unknown type to skip the message.