eth/downloader: return invalid chain (peer drop) on import fails #2801
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If block processing fails in the downloader, it is currently bubbling up that particular error up to the very top of the sync cycle. However, the sync cycle only handles downloader specific errors correctly with regards to peer drops, it doesn't know about other errors. This causes block import failures to be silently discarded as "some random unimportant error", whereas it's very important: the origin peer tried to feed us something bad that we couldn't handle.
In our current network this doesn't really happen, because there isn't a heavy bad chin present. With the DAO hard-fork on the other hand, depending on which side of the fork you're on, there will be a heavy "other" chain, the members of which we'd like to drop.
This PR changes the bubbled up error from the random error type returned from blockchain to the downloader specific
errInvalidChain
, signalling that the chain being processed is very bad and its originator peer should be dropped.Chalk one up for
hive
.