bitauth / chaingraph

A multi-node blockchain indexer and GraphQL API

Home Page:https://chaingraph.cash/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Estimate sync progress more accurately (based on transaction count rather than block height)

bitjson opened this issue · comments

When logging sync progress percentages, Chaingraph should use the GuessVerificationProgress algorithm from the Satoshi client. The source data should be provided in an environment variable like CHAINGRAPH_ESTIMATED_TRANSACTION_RATES, and rather than attempting to associate the proper estimate with each node/chain, we should just mark each estimate with the block hash. After Chaingraph completes the headers-first sync, it will typically see some block header hash it recognizes, and the better sync progress estimate will be used in agent logging.

We can copy ChainTxData from one of the Satoshi-client derived implementations for each chain/network. E.g. for BCH mainnet currently (hash : timestamp : transaction count : and per-second estimate after timestamp):

CHAINGRAPH_ESTIMATED_TRANSACTION_RATES=000000000000000000d7e938f43eb520468fc75dc626c54ec770f9cd1bd6bc1d:1628025092:1628025092:1.49