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

Sync logic change proposal #304

Open
ghost opened this issue Mar 30, 2019 · 0 comments
Open

Sync logic change proposal #304

ghost opened this issue Mar 30, 2019 · 0 comments

Comments

@ghost
Copy link

ghost commented Mar 30, 2019

Current sync logic of explorer is very inefficient for importing various informations via different web3 calls.

So I would like to propose and adopt a new db import logic for explorer.

Current method:

  1. Checks latest block number

  2. Sync starts from latest block number to genesis block in "descending" order.

  3. Fetch new blocks while on initial sync

  4. Account list & BlockStats should be run on different process

New method:

  1. Checks if the node is on sync

  2. Checks latest block number on node

  3. Sync starts from genesis block to latest "detected" block number in "ascending" order.

  4. Fetch account list and blockstats in parallel with block & tx collection. ( Use listAccounts method and rescan option if it is a first sync or db document not exists on db )

  5. If the initial sync is finished then fetch new blocks and transactions via web3.eth.subscribe method.

  6. eth.subscribe will report multiple blocks in a single call if the reorg happens, then update the document and move reorged blocks in different collection.

cc @hackmod @realcodywburns

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants