mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
revert changes
This commit is contained in:
@ -2278,16 +2278,7 @@ impl<TX: DbTxMut + DbTx + 'static, N: NodeTypesForProvider> StateWriter
|
||||
let mut block_receipts = Vec::with_capacity(block_body.tx_count as usize);
|
||||
for num in block_body.tx_num_range() {
|
||||
if receipts_iter.peek().is_some_and(|(n, _)| *n == num) {
|
||||
// Safe to unwrap here since we just peeked and confirmed it exists
|
||||
// However, for maximum safety in database operations, we still handle it
|
||||
if let Some((_, receipt)) = receipts_iter.next() {
|
||||
block_receipts.push(receipt);
|
||||
} else {
|
||||
// This should never happen based on peek(), but handle gracefully
|
||||
return Err(ProviderError::Database(reth_db::DatabaseError::Other(
|
||||
"Receipt iterator state mismatch during state reconstruction".into()
|
||||
)));
|
||||
}
|
||||
block_receipts.push(receipts_iter.next().unwrap().1);
|
||||
}
|
||||
}
|
||||
receipts.push(block_receipts);
|
||||
@ -3079,13 +3070,9 @@ impl<TX: DbTxMut + DbTx + 'static, N: NodeTypesForProvider + 'static> BlockWrite
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// Safe to unwrap after empty check, but use defensive programming for critical DB ops
|
||||
let first_number = blocks.first()
|
||||
.expect("Blocks vector guaranteed non-empty after length check")
|
||||
.number();
|
||||
let first_number = blocks.first().unwrap().number();
|
||||
|
||||
let last = blocks.last()
|
||||
.expect("Blocks vector guaranteed non-empty after length check");
|
||||
let last = blocks.last().unwrap();
|
||||
let last_block_number = last.number();
|
||||
|
||||
let mut durations_recorder = metrics::DurationsRecorder::default();
|
||||
@ -3215,4 +3202,4 @@ impl<TX: DbTx + 'static, N: NodeTypes + 'static> DBProvider for DatabaseProvider
|
||||
fn prune_modes_ref(&self) -> &PruneModes {
|
||||
self.prune_modes_ref()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user