Skip to content

Conversation

@benthecarman
Copy link
Collaborator

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.

@benthecarman benthecarman added bug node work for the node project labels Dec 3, 2020
@benthecarman benthecarman added this to the v0.5.0 milestone Dec 3, 2020
@benthecarman benthecarman force-pushed the fix-p2p-parsing-unknown-msgs branch from 28abbc3 to 4823b17 Compare December 3, 2020 09:56
loop(newRemainingBytes, message :: accum)
case Failure(_) =>
// Can't parse message yet, we need to wait for more bytes
(accum.reverse, remainingBytes)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why accum.reverse?

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Collaborator Author

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

@benthecarman benthecarman force-pushed the fix-p2p-parsing-unknown-msgs branch from 4823b17 to 03024f2 Compare December 3, 2020 18:11
@Christewart
Copy link
Contributor

Tested 03024f2 by syncing a few thousand blocks on testnet, everything worked fine.

@Christewart Christewart merged commit 9a5ba7b into bitcoin-s:master Dec 6, 2020
@benthecarman benthecarman deleted the fix-p2p-parsing-unknown-msgs branch December 6, 2020 19:54
Christewart pushed a commit that referenced this pull request May 1, 2021
* Fix P2PClient parsing unknown messages

* Use Vector, calculate correct checksum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug node work for the node project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants