You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
while optimistic_headers.len() < chain_buffer_size &&
240
-
optimistic_headers.first().unwrap().number != 0
240
+
optimistic_headers.first().expect("chain can not be empty").number != 0
241
241
{
242
-
tracing::trace!(target:"scroll::chain_orchestrator", number = ?(optimistic_headers.first().unwrap().number - 1),"fetching block");
243
-
let parent_hash = optimistic_headers.first().unwrap().parent_hash;
242
+
tracing::trace!(target:"scroll::chain_orchestrator", number = ?(optimistic_headers.first().expect("chain can not be empty").number - 1),"fetching block");
243
+
let parent_hash =
244
+
optimistic_headers.first().expect("chain can not be empty").parent_hash;
244
245
let header = network_client
245
246
.get_header(BlockHashOrNumber::Hash(parent_hash))
246
247
.await?
@@ -289,8 +290,8 @@ impl<
289
290
// If we are in optimistic mode and the received chain can not be reconciled with the
290
291
// in-memory chain we break. We will reconcile after optimistic sync has completed.
291
292
if*optimistic_mode.lock().await &&
292
-
received_chain_headers.last().unwrap().number <
293
-
current_chain_headers.front().unwrap().number
293
+
received_chain_headers.last().expect("chain can not be empty").number <
294
+
current_chain_headers.front().expect("chain can not be empty").number
// If the received header tail has a block number that is less than the current header
301
302
// tail then we should fetch more headers for the current chain to aid
302
303
// reconciliation.
303
-
if received_chain_headers.last().unwrap().number <
304
+
if received_chain_headers.last().expect("chain can not be empty").number <
304
305
current_chain_headers.front().expect("chain can not be empty").number
305
306
{
306
307
for _ in0..BATCH_FETCH_SIZE{
307
-
if current_chain_headers.front().unwrap().number.saturating_sub(1) <=
308
+
if current_chain_headers
309
+
.front()
310
+
.expect("chain can not be empty")
311
+
.number
312
+
.saturating_sub(1) <=
308
313
latest_safe_block.number
309
314
{
310
315
tracing::info!(target:"scroll::chain_orchestrator", hash = %latest_safe_block.hash, number = %latest_safe_block.number,"reached safe block number for current chain - terminating fetching.");
311
316
break;
312
317
}
313
-
tracing::trace!(target:"scroll::chain_orchestrator", number = ?(current_chain_headers.front().unwrap().number - 1),"fetching block for current chain");
318
+
tracing::trace!(target:"scroll::chain_orchestrator", number = ?(current_chain_headers.front().expect("chain can not be empty").number - 1),"fetching block for current chain");
tracing::trace!(target:"scroll::chain_orchestrator", number = ?(received_chain_headers.last().unwrap().number - 1),"fetching block");
372
+
tracing::trace!(target:"scroll::chain_orchestrator", number = ?(received_chain_headers.last().expect("chain can not be empty").number - 1),"fetching block");
0 commit comments