Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: laanwj on June 15, 2011, 08:29:35 PM



Title: How to determine how far block download has progressed?
Post by: laanwj on June 15, 2011, 08:29:35 PM
I'd like to show a progress bar on initial download on the block chain, or when the client was disconnected for a while and needs to catch up.

This would give the user a more useful indication than just a raw count.

There is nBestHeight (which can be queried with getblockcount/getblocknumber), and the IsInitialBlockDownload function, but those only take into account the downloaded blocks. Is there a way to find out how many blocks there are in total? (without querying a third party)



Title: Re: How to determine how far block download has progressed?
Post by: kjj on June 15, 2011, 11:24:55 PM
No.


Title: Re: How to determine how far block download has progressed?
Post by: theymos on June 16, 2011, 02:30:08 AM
The version messages exchanged between peers right after connecting contains the current block height. You could take the median of your peers' heights as a low-reliability number.


Title: Re: How to determine how far block download has progressed?
Post by: laanwj on June 16, 2011, 05:07:32 AM
The version messages exchanged between peers right after connecting contains the current block height. You could take the median of your peers' heights as a low-reliability number.
Thanks. Low-reliability is not an issue, as it is an indication for visual purposes.