zebrad: remove block verification timeout
Because we set the lookahead limit to be at least twice the size of a checkpoint, we don't have a risk of timeouts.
This commit is contained in:
parent
e9c847bbd7
commit
6de824bd99
|
|
@ -46,21 +46,6 @@ const TIPS_RESPONSE_TIMEOUT: Duration = Duration::from_secs(6);
|
|||
/// Controls how long we wait for a block download request to complete.
|
||||
const BLOCK_DOWNLOAD_TIMEOUT: Duration = Duration::from_secs(20);
|
||||
|
||||
/// The maximum amount of time that Zebra should take to download a checkpoint
|
||||
/// full of blocks. Based on the current `MAX_CHECKPOINT_BYTE_SIZE`.
|
||||
///
|
||||
/// We assume that Zebra nodes have at least 10 Mbps bandwidth, and allow some
|
||||
/// extra time for request latency.
|
||||
const MAX_CHECKPOINT_DOWNLOAD_SECONDS: u64 = 300;
|
||||
|
||||
/// Controls how long we wait for a block verify task to complete.
|
||||
///
|
||||
/// This timeout makes sure that the syncer and verifiers do not deadlock.
|
||||
/// When the lookahead limit is reached, the syncer waits for blocks to verify
|
||||
/// (or fail). If the verifiers are also waiting for more blocks from the syncer,
|
||||
/// then without a timeout, Zebra would deadlock.
|
||||
const BLOCK_VERIFY_TIMEOUT: Duration = Duration::from_secs(MAX_CHECKPOINT_DOWNLOAD_SECONDS);
|
||||
|
||||
/// Controls how long we wait to restart syncing after finishing a sync run.
|
||||
///
|
||||
/// This timeout should be long enough to:
|
||||
|
|
@ -102,10 +87,7 @@ where
|
|||
lookahead_limit: usize,
|
||||
downloads: Pin<
|
||||
Box<
|
||||
Downloads<
|
||||
Hedge<ConcurrencyLimit<Retry<zn::RetryLimit, Timeout<ZN>>>, AlwaysHedge>,
|
||||
Timeout<ZV>,
|
||||
>,
|
||||
Downloads<Hedge<ConcurrencyLimit<Retry<zn::RetryLimit, Timeout<ZN>>>, AlwaysHedge>, ZV>,
|
||||
>,
|
||||
>,
|
||||
}
|
||||
|
|
@ -158,10 +140,7 @@ where
|
|||
Self {
|
||||
tip_network,
|
||||
state,
|
||||
downloads: Box::pin(Downloads::new(
|
||||
block_network,
|
||||
Timeout::new(verifier, BLOCK_VERIFY_TIMEOUT),
|
||||
)),
|
||||
downloads: Box::pin(Downloads::new(block_network, verifier)),
|
||||
prospective_tips: HashSet::new(),
|
||||
genesis_hash: genesis_hash(config.network.network),
|
||||
lookahead_limit: std::cmp::max(config.sync.lookahead_limit, MIN_LOOKAHEAD_LIMIT),
|
||||
|
|
@ -587,20 +566,9 @@ mod test {
|
|||
fn ensure_timeouts_consistent() {
|
||||
zebra_test::init();
|
||||
|
||||
let max_download_retry_time =
|
||||
BLOCK_DOWNLOAD_TIMEOUT.as_secs() * (BLOCK_DOWNLOAD_RETRY_LIMIT as u64);
|
||||
assert!(
|
||||
max_download_retry_time < BLOCK_VERIFY_TIMEOUT.as_secs(),
|
||||
"Verify timeout should allow for previous block download retries"
|
||||
);
|
||||
assert!(
|
||||
BLOCK_DOWNLOAD_TIMEOUT.as_secs() * 2 < SYNC_RESTART_TIMEOUT.as_secs(),
|
||||
"Sync restart should allow for pending and buffered requests to complete"
|
||||
);
|
||||
|
||||
assert!(
|
||||
SYNC_RESTART_TIMEOUT < BLOCK_VERIFY_TIMEOUT,
|
||||
"Verify timeout should allow for a sync restart"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue