Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Fix ImportBlocksTask to only request from peers that claim to have the blocks #1047

Merged
merged 2 commits into from
Mar 5, 2019

Conversation

ajsutton
Copy link
Contributor

@ajsutton ajsutton commented Mar 5, 2019

PR description

ImportBlocksTask was requesting data from any idle peer without checking that the peer had a chain height above the starting block it was requesting. As a result, peers earlier on the chain would respond with an empty response and risk being disconnected with USELESS_PEER.

Also includes the type of request we made when recording a useless response to make debugging easier.

@@ -96,6 +97,11 @@ protected void executeTaskWithPeer(final EthPeer peer) throws PeerNotConnected {
});
}

@Override
protected Optional<EthPeer> findSuitablePeer() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wonder if its worth it to require subclasses to implement this...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting. Will take a look at that and follow up with a PR if it works out.

@ajsutton ajsutton merged commit a64432c into PegaSysEng:master Mar 5, 2019
@ajsutton ajsutton deleted the select-appropriate-peer branch March 5, 2019 20:09
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