Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Connect to unsynced peers, and trinity peers #618

Merged
merged 2 commits into from
May 20, 2019

Conversation

carver
Copy link
Contributor

@carver carver commented May 16, 2019

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

put a cute animal picture link inside the parentheses

@carver carver requested a review from pipermerriam May 16, 2019 22:38
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.
@carver carver force-pushed the connect-to-syncing-peers branch from f184da5 to 7dc6403 Compare May 16, 2019 22:42
Copy link
Member

@pipermerriam pipermerriam left a 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....

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..."
Copy link
Member

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.

Copy link
Contributor Author

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 ?

Copy link
Member

@pipermerriam pipermerriam left a 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...

@carver carver merged commit 62164b7 into ethereum:master May 20, 2019
@carver carver deleted the connect-to-syncing-peers branch May 20, 2019 17:45
carver added a commit that referenced this pull request May 20, 2019
carver added a commit that referenced this pull request May 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants