zebrad::components::sync

Constant SYNC_RESTART_DELAY

source
const SYNC_RESTART_DELAY: Duration;
Expand description

Controls how long we wait to restart syncing after finishing a sync run.

This delay should be long enough to:

  • allow zcashd peers to process pending requests. If the node only has a few peers, we want to clear as much peer state as possible. In particular, zcashd sends “next block range” hints, based on zcashd’s internal model of our sync progress. But we want to discard these hints, so they don’t get confused with ObtainTips and ExtendTips responses, and
  • allow in-progress downloads to time out.

This delay is particularly important on instances with slow or unreliable networks, and on testnet, which has a small number of slow peers.

Using a prime number makes sure that syncer fanouts don’t synchronise with other crawls.

§Correctness

If this delay is removed (or set too low), the syncer will sometimes get stuck in a failure loop, due to leftover downloads from previous sync runs.