Skip to content
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

Full sync need to broadcast block hashes to peers after a sync cycle completed #1304

Closed
jangko opened this issue Nov 17, 2022 · 1 comment
Closed
Assignees
Labels
Hive Sync Prevents or affects sync with Ethereum network

Comments

@jangko
Copy link
Contributor

jangko commented Nov 17, 2022

This is mentioned in the spec albeit a bit vague and not forced. Also needed in hive test.

preparation:

  • maintain a knownByPeer data structure. Can be as simple as Table[Peer, Table[BlockHash, Time]].
  • periodically, cleanup this table after a period of time have passed(e.g. every 20 minutes)
  • although this table is primarily used by newBlockHashes and newBlock handler of eth wire protocol, we need to prepare for it.

on peer connected(not mentioned by the spec, but implicitly by hive test, maybe part of robustness test):

  • if peer bestDifficulty is lower than our total difficulty:
  • using peer bestBlockHash to calculate distance with our best block hash.
  • if the distance is one, send newBlock
  • if the distance is more than one but less than e.g. maxHeadersFetch, send newBlockHashes.
  • if the distance is too far, ignore the peer

after a sync cycle completed:

  • get peers from peer pool(or local peer pool maintained by the synchronizer), except the current peer.
  • build a hash list filtered by knownByPeer for each peers.
  • check if the block is POS block or not. if it it a POS block, do not broadcast it.
  • if the hash list is not empty, send it to the peer using newBlockHashes.

on peer disconnected:

  • remove peer from knownByPeer table
@jangko jangko added Hive Sync Prevents or affects sync with Ethereum network labels Nov 17, 2022
@jangko
Copy link
Contributor Author

jangko commented Jun 26, 2024

Obsolete after full sync removed from nimbus-eth1

@jangko jangko closed this as completed Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hive Sync Prevents or affects sync with Ethereum network
Projects
None yet
Development

No branches or pull requests

2 participants