How does Bitcoin Core calculate sync time?

1 reply 344 views
dave.forkMember
Posts: 375 · Reputation: 185
#1Dec 27, 2021, 08:24 AM
So, how exactly does Bitcoin Core figure out the sync time? Like, it gets the current block height and the latest chain tip from other nodes, but there’s no fixed time to verify a block, right? It can take ages if the block's complicated or barely any time if it’s simple. What’s the best way to estimate this? Average verification time of the last few blocks or something? I’m trying to sync testnet3 and it just jumped from 89 minutes to 100... what gives?
5 Reply Quote Share
matrix2021Full Member
Posts: 92 · Reputation: 612
#2Dec 29, 2021, 12:49 PM
Bitcoin Core uses some set values that change with each update. For estimating sync time, it looks at the total number of transactions in the blockchain and the average transactions per second over a recent block window, usually like 4096 blocks. It also considers the timestamp of the current block. With these data points, it figures out how many transactions are in the chain and calculates how many have already been processed. Once it surpasses the hardcoded tx count, the estimator adapts to current conditions and carries on from there.
2 Reply Quote Share

Related topics