Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: bushstar on October 18, 2021, 07:06:40 AM



Title: Why not use fixed time instead of median for time in the past for new blocks?
Post by: bushstar on October 18, 2021, 07:06:40 AM
New blocks that are more than 2 hours ahead of the local time are rejected. For backwards time blocks cannot be less than than the median time of the last eleven blocks. Why not use a fixed time going backwards like the forwards time? The longer we go without a block the larger the backwards time range becomes, a fixed time provides a fixed range from past to future blocks.


Title: Re: Why not use fixed time instead of median for time in the past for new blocks?
Post by: o_e_l_e_o on October 18, 2021, 09:26:45 AM
Why not use a fixed time going backwards like the forwards time?
Because then that time would change. If the rules said a block could not be mined more than 2 hours behind network time, and I mine a block with a timestamp 1:59:59 behind current network time, then by the time I broadcast it to the network, some nodes will start to reject it since it will now be greater than 2 hours behind network time by the time they receive it. By using a median of the last 11 blocks, the lower limit for the timestamp is fixed before the block is mined.

The longer we go without a block the larger the backwards time range becomes, a fixed time provides a fixed range from past to future blocks.
Note that we use the median, not the mean. The median of the last 11 blocks is the timestamp of the 6th last block. It doesn't matter if one of the blocks took 1 second or 1 hour to mine - the median will not change.


Title: Re: Why not use fixed time instead of median for time in the past for new blocks?
Post by: bushstar on October 18, 2021, 09:39:34 AM
Thanks, that makes sense, otherwise a block on the edge could start being rejected during propagation.


Title: Re: Why not use fixed time instead of median for time in the past for new blocks?
Post by: DannyHamilton on October 18, 2021, 03:24:28 PM
Wouldn't it also then be impossible to sync up a new node?  Since nearly ALL blocks received would be older than whatever time you choose.