Warn when the user's configured lookahead limit is ignored

This commit is contained in:
teor 2021-01-13 19:13:47 +10:00 committed by Deirdre Connolly
parent 3699bbdae6
commit c2893dce51
1 changed files with 9 additions and 1 deletions

View File

@ -188,13 +188,21 @@ where
);
// We apply a timeout to the verifier to avoid hangs due to missing earlier blocks.
let verifier = Timeout::new(verifier, BLOCK_VERIFY_TIMEOUT);
// Warn the user if we're ignoring their configured lookahead limit
let lookahead_limit = if config.sync.lookahead_limit < MIN_LOOKAHEAD_LIMIT {
tracing::warn!(config_lookahead_limit = ?config.sync.lookahead_limit, ?MIN_LOOKAHEAD_LIMIT,
"configured lookahead limit too low: using minimum lookahead limit");
MIN_LOOKAHEAD_LIMIT
} else {
config.sync.lookahead_limit
};
Self {
tip_network,
state,
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),
lookahead_limit,
}
}