-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix sync #5550
Conversation
@@ -217,7 +217,7 @@ bool BlockChainSync::requestDaoForkBlockHeader(NodeID const& _peerID) | |||
return false; | |||
|
|||
m_daoChallengedPeers.insert(_peerID); | |||
m_host.peer(_peerID).requestBlockHeaders(daoHardfork, 1, 0, false); | |||
m_host.peer(_peerID).requestBlockHeaders(static_cast<unsigned>(daoHardfork), 1, 0, false); |
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.
After daoHardfork
type was changed to u256
in #5539, overload resolution preferred requestBlockHeaders(h256 const&, ...)
instead of requestBlockHeaders(unsigned, ...)
; sync with the main net was not working because of this.
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.
Why do we need the other overload?
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.
eth wire protocol defines requests for headers both by number and by hash. We request the latest known block header by hash, when we begin to sync from the peer. Because we receive only this hash in the Status message.
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.
Strangely Status message spec includes block number,too https://github.com/ethereum/devp2p/blob/master/caps/eth.md#status-0x00
But quick experiment shows that no one actually sends block number, all Status messages contain only hash. Aleth also doesn't send it.
Thanks for fixing this! What sorts of errors were you seeing? Would it maybe make sense for me to look into resurrecting the blockchain sync tests PR you created a while back so we can catch these issues during PRs? |
@@ -217,7 +217,7 @@ bool BlockChainSync::requestDaoForkBlockHeader(NodeID const& _peerID) | |||
return false; | |||
|
|||
m_daoChallengedPeers.insert(_peerID); | |||
m_host.peer(_peerID).requestBlockHeaders(daoHardfork, 1, 0, false); | |||
m_host.peer(_peerID).requestBlockHeaders(static_cast<unsigned>(daoHardfork), 1, 0, false); |
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.
Why do we need the other overload?
Never mind about the errors you were seeing, tried it myself and am seeing "invalid genesis hash" (which makes sense after looking at the changes + overload since
and
|
Agreed, I did a quick source search and I'm not seeing any code calling it...as such I think it can be removed. |
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 think we should remove the overload
@halfalicious It's needed here aleth/libethereum/BlockChainSync.cpp Line 256 in ba3f45a
|
I see. The problem is than |
Actually, the issue this was fixing wasn't the cause of the mainnet sync "invalid genesis hash" issue that I was seeing...failing the dao challenge would manifest as "Peer from another fork": aleth/libethereum/BlockChainSync.cpp Lines 438 to 443 in dbbfd5b
|
This issue looked like the sync was never proceeding after (invalid) DAO fork challenge, and was just stuck. |
No description provided.