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

Add progress percentage to sync log, based on timestamps #1151

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

svarogg
Copy link

@svarogg svarogg commented Mar 26, 2018

This adds progress xx.xx% clause to the SYNC log messages, making it a bit clearer how long will sync take.
Bases the calculation on time differences between now, first block and current block. It is not perfect, but I'm not sure a better approach exists and is easily achievable.

This fixes #1092.

@stevenroose
Copy link
Contributor

I don't think this makes much sense. Block times are really not an indicator for how far the sync is progressed. The first 3/4 of the chain is very sparse. Then blocks get full gradually and start to take a lot more time. Then the last checkpoint is gone and btcd start validating txs so it again slows down. Then there is segwit with even bigger blocks, ...

Whatever new thing comes next, it will always end up being a "windows load bar" like I call them, going very fast in the beginning, and slowing down a ton at the end. (A typical "windows load bar" is characterized by going smooth and hanging at 99%, though, but you get the gist.)

@stevenroose
Copy link
Contributor

Besides, if some GUI wants to show a progress, we all know the first block is 3/1/2009.

@svarogg
Copy link
Author

svarogg commented Apr 8, 2018

First block is 3/1/2009 in mainnet, but what about testnets, etc?

Anyway, I did this mostly to get acquainted with the code, according to suggestion in the issue. I don't see a better approach to approximating progress, and I must say that while syncing my node, these prints were useful to get some sense on where we're standing.

If there's anything that can make this code mergeable please let me know and I'll try to do it, otherwise feel free to decline this PR.

@ghost
Copy link

ghost commented Oct 28, 2019

Just to reference for those who googled this issue (like me). Here is some snippet how to calculate percentage of blocks downloaded:

Disclaimer: Its is not quite a good metric of timewise-progress (explained in previous #1151 (comment))

Note: It uses jq which is not usually present on linux distros and need to be installed. (https://linuxhint.com/bash_jq_command/)

 jq -n $(btcctl --rpcuser=REPLACE --rpcpass=REPLACE getinfo | jq -r '.blocks')/$(curl -s https://blockchain.info/q/getblockcount)*100

@jakesylvestre
Copy link
Collaborator

@jcvernaleo (as per #1530)

  • Low priority
  • Enhancement

By the way- thanks @petrhejna

@jakesylvestre
Copy link
Collaborator

I think we need to rebase this as per this comment. Would love to see this merged

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

Successfully merging this pull request may close these issues.

Display Sync Percentage
4 participants