-
Notifications
You must be signed in to change notification settings - Fork 20.3k
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
GetBlockHeaders [reverse = true, skip = 0, origin type = hash] duplicates genesis in response #2076
Comments
Hmmm, indeed I've managed to reproduce it. The bug is not in that line of code, it's a side effect of using the query itself as an iterator. When we reach the root of the chain, the parent of the genesis block is the nil hash, which is interpreted in a special way in the code. I guess we haven't caught this issue because we don't use this type of queries currently in the code. Let me see how to cleanly solve this. |
This should be fixed by the commit linked above. If you try it out yourself, please report back whether it worked or not. Otherwise is should be reviewed fairly quickly as it's a trivial fix and land the develop I guess by tonight. |
We are currently not using such messages as well, just accidentally found this problem. |
eth: fix #2076, where end of hash query was interpreted number query
Fixed and merged. Thanks for the report! |
E.g. when sending
GetBlockHeaders(Origin = blockHash, Amount = 1000, Skip = 1, Reverse = true)
(whereblockHash
is the block #4) I'm getting block headers#4, #2, #0
When sending with
Skip = 0
getting headers#4, #3, #2, #1, #0, #0
(two zero blocks at the end)The problem seems to be in that line:
https://github.com/ethereum/go-ethereum/blob/master/eth/handler.go#L421
The text was updated successfully, but these errors were encountered: