Function zebra_consensus::block::check::time_is_valid_at

source ·
pub fn time_is_valid_at(
    header: &Header,
    now: DateTime<Utc>,
    height: &Height,
    hash: &Hash
) -> Result<(), BlockTimeError>
Expand description

Returns Ok(()) if header.time is less than or equal to 2 hours in the future, according to the node’s local clock (now).

This is a non-deterministic rule, as clocks vary over time, and between different nodes.

“In addition, a full validator MUST NOT accept blocks with nTime more than two hours in the future according to its clock. This is not strictly a consensus rule because it is nondeterministic, and clock time varies between nodes. Also note that a block that is rejected by this rule at a given point in time may later be accepted.” §7.5

If the header time is invalid, returns an error containing height and hash.