-
Notifications
You must be signed in to change notification settings - Fork 107
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
Ignore non-verack and non-version messages in handshake #3522
Conversation
The ziggurat tests are a bit intermittent from here, sometimes stuff timeout, however with the code of this pull request the following tests that were always failing before now pass: Verack:
Version
|
By the way, it seems ziggurat uses the testnet protocol version so in order to make the tests run properly, the constant need to be updated. I sent a ticket to make this a bit easier as i had a hard time figuring it out by myself. |
Codecov Report
@@ Coverage Diff @@
## main #3522 +/- ##
==========================================
+ Coverage 78.34% 80.44% +2.10%
==========================================
Files 267 274 +7
Lines 31526 32243 +717
==========================================
+ Hits 24698 25939 +1241
+ Misses 6828 6304 -524 |
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.
Try using a loop to ignore messages that aren't the ones we're looking for.
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.
This is a nice compact fix for this issue, thanks!
I just want to tweak the debugging a bit. So if peer connections start behaving differently after this change, we'll be able to see if the skipped messages.
Co-authored-by: teor <[email protected]>
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.
Let's go!
This change might fix some block explorers, so we should check them again when we have time: |
Motivation
We want to ignore some messages during handshake to make the conformance tests of ziggurat pass: https://github.com/eqlabs/ziggurat/blob/master/SPEC.md#zg-conformance-003
Close #3429
Solution
Ignore the verack can be done just by not closing the connection when receiving other messages at the end of the handshake. This is done in cce709a
The version is a bit trickier, we need to wait for another message when we receive a non version one at the beginning of the handshake.
I made a proof of concept of this at cce709a however the code can be improved as it is doing some duplicated work. I am looking for some suggestions there but before that i want to make sure that we will want to really do that as it is in this pull request.
Review
I will like @teor2345 and/or @jvff to take a look.
Reviewer Checklist