zebrad::components::sync

Constant BLOCK_DOWNLOAD_TIMEOUT

source
pub(super) const BLOCK_DOWNLOAD_TIMEOUT: Duration;
Expand description

Controls how long we wait for a block download request to complete.

This timeout makes sure that the syncer doesn’t hang when:

  • the lookahead queue is full, and
  • we are waiting for a request that is stuck.

See BLOCK_VERIFY_TIMEOUT for details.

§Correctness

If this timeout is removed (or set too high), the syncer will sometimes hang.

If this timeout is set too low, the syncer will sometimes get stuck in a failure loop.

We set the timeout so that it requires under 1 Mbps bandwidth for a full 2 MB block.