-
Notifications
You must be signed in to change notification settings - Fork 146
Connect to unsynced peers, and trinity peers #618
Conversation
Trinity peers were not communicating DAO headers during handshake, so trinity would not connect to another trinity node. Solution was to immediately add peer to pool during boot, and then kick it back out if it fails the DAO check. We were previously failing any peer who couldn't answer with the DAO fork header. That means that unsynced peers would be rejected. Modified to accept unsynced peers for now.
f184da5
to
7dc6403
Compare
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.
If you don't want to tackle the requested change now, can you open an issue for it.
It seems like it should only be a few lines of code....
trinity/protocol/common/boot.py
Outdated
f"{self.peer} failed to return DAO fork check headers" | ||
self.logger.debug( | ||
f"{self.peer} returned only {headers!r} at DAO fork. " | ||
"Assuming peer is syncing, for now..." |
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.
I'd advocate for this to fall back to request the peer's announced HEAD
block and to check whether the returned block number is less than the DAO headers. It seems we should be able to actually verify whether a peer responded because they don't have the headers.
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.
How about something like 7ac9344 ?
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.
Not a comment on your code because I recognize all of the things that justify every one of those if/else/try/except/etc blocks but that is a mouthful just to get one header. We've got to figure out how to make that easier...
Trinity peers were not communicating DAO headers during handshake, so trinity would not connect to another trinity node. (lol, am I the first one to try this?)
Why? I think it's because all incoming requests were buffered, including the request for the DAO headers. So they both asked each other for the DAO headers and never answered because they were waiting for the other to respond.
Current solution is to immediately add peer to pool during boot, and then kick it back out if it fails the DAO check. At least, that's the solution when I connected my two trinity peers together.
Bonus: We were previously failing any peer who couldn't answer with the DAO
fork header. That means that unsynced peers would be rejected. This modifies the peer boot to accept unsynced peers for now.
To-Do
Cute Animal Picture