When building a block template, cur_time is unconditionally clamped to [median-time-past + 1, median-time-past + 90 min]:
|
let cur_time = cur_time.clamp(min_time, max_time); |
A fresh regtest chain starts from the 2011-era genesis, so real time is always far above the clamp ceiling and every mined block gets pinned to median-time-past + 90 min — chain time advances ~90 minutes per block regardless of real time. After roughly 40 blocks, the block timestamps exceed a following zcashd's future-block window and it rejects them ("timestamp ... too far ahead of local time"), stalling its sync. zcashd's own regtest miner advances block time minimally instead.
Regtest-only; no mainnet impact (on mainnet the clamp is the correct consensus behavior, since real time and chain time agree). Like the regtest difficulty issue, this blocks any sidecar test flow that mines ~40+ blocks.
Reproduce: mine ~45 regtest blocks on zakurad with a zcashd sidecar following; the sidecar stalls around height 40–44 rejecting blocks as too far ahead of local time.
Fix reference: fixed upstream in Zebra (ZcashFoundation/zebra#10952, commit c7691893e): on Regtest, advance block time minimally (just above the median-time-past) instead of clamping now().
When building a block template,
cur_timeis unconditionally clamped to[median-time-past + 1, median-time-past + 90 min]:zakura/zakura-state/src/service/read/difficulty.rs
Line 243 in 7880676
A fresh regtest chain starts from the 2011-era genesis, so real time is always far above the clamp ceiling and every mined block gets pinned to
median-time-past + 90 min— chain time advances ~90 minutes per block regardless of real time. After roughly 40 blocks, the block timestamps exceed a following zcashd's future-block window and it rejects them ("timestamp ... too far ahead of local time"), stalling its sync. zcashd's own regtest miner advances block time minimally instead.Regtest-only; no mainnet impact (on mainnet the clamp is the correct consensus behavior, since real time and chain time agree). Like the regtest difficulty issue, this blocks any sidecar test flow that mines ~40+ blocks.
Reproduce: mine ~45 regtest blocks on zakurad with a zcashd sidecar following; the sidecar stalls around height 40–44 rejecting blocks as too far ahead of local time.
Fix reference: fixed upstream in Zebra (ZcashFoundation/zebra#10952, commit c7691893e): on Regtest, advance block time minimally (just above the median-time-past) instead of clamping
now().