This may sound petty, but it's not necessarily the time the block was mined but rather the timestamp the miner has chosen to put into the blockheader of block 808877. Both times must not be the same and are allowed to differ by quite some amount.
Very correct. If we want to be specific, the block time must be greater or equal with the median time of the previous 11 blocks + 1 second, and less than the adjusted network time + 2 hours.
These are the particular lines in validation.cpp that check it:
// Check timestamp against prev
if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast())
return state.Invalid(BlockValidationResult::BLOCK_INVALID_HEADER, "time-too-old", "block's timestamp is too early");
// Check timestamp
if (block.Time() > now + std::chrono::seconds{MAX_FUTURE_BLOCK_TIME}) {
return state.Invalid(BlockValidationResult::BLOCK_TIME_FUTURE, "time-too-new", "block timestamp too far in the future");
}
- GetMedianTimePast() can be found in
chain.h, and it returns the median time of the past 11 blocks.
- MAX_FUTURE_BLOCK_TIME can also be found in
chain.h, and it is equal with 7200 seconds (2 * 60 * 60).
According to one of my nodes and unknown propagation delay of the node's network mining time and block header timestamp seem to be pretty close for block 808877:
2023-09-22T18:14:35Z Saw new header hash=000000000000000000007761b9076f7e5b29b5f7ef4a74cd4372b1c0631a20c9 height=808877
2023-09-22T18:14:35Z [net] Saw new cmpctblock header hash=000000000000000000007761b9076f7e5b29b5f7ef4a74cd4372b1c0631a20c9 peer=3540
2023-09-22T18:14:35Z UpdateTip: new best=000000000000000000007761b9076f7e5b29b5f7ef4a74cd4372b1c0631a20c9 height=808877 version=0x20008000 log2_work=94.433168 tx=898739166 date='2023-09-22T18:13:57Z' progress=1.000000 cache=27.1MiB(37151txo)
Mine received it 2 seconds after yours. You could be the one who sent it to me.
![Smiley](https://bitcointalk.org/Smileys/default/smiley.gif)
2023-09-22T18:14:37Z UpdateTip: new best=000000000000000000007761b9076f7e5b29b5f7ef4a74cd4372b1c0631a20c9 height=808877 version=0x20008000 log2_work=94.433168 tx=898739166 date='2023-09-22T18:13:57Z' progress=1.000000 cache=123.6MiB(805657txo)