File tree Expand file tree Collapse file tree 2 files changed +3
-9
lines changed
crates/anvil/src/eth/backend/mem Expand file tree Collapse file tree 2 files changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -1006,8 +1006,8 @@ impl Backend {
1006
1006
}
1007
1007
}
1008
1008
1009
- if let Some ( block ) = state. blocks . last ( ) {
1010
- let header = & block . header ;
1009
+ if let Some ( latest ) = state. blocks . iter ( ) . max_by_key ( |b| b . header . number ) {
1010
+ let header = & latest . header ;
1011
1011
let next_block_base_fee = self . fees . get_next_block_base_fee_per_gas (
1012
1012
header. gas_used as u128 ,
1013
1013
header. gas_limit as u128 ,
Original file line number Diff line number Diff line change @@ -409,13 +409,7 @@ impl BlockchainStorage {
409
409
}
410
410
411
411
pub fn serialized_blocks ( & self ) -> Vec < SerializableBlock > {
412
- let mut blocks = self
413
- . blocks
414
- . values ( )
415
- . map ( |block| block. clone ( ) . into ( ) )
416
- . collect :: < Vec < SerializableBlock > > ( ) ;
417
- blocks. sort_by_key ( |block| block. header . number ) ;
418
- blocks
412
+ self . blocks . values ( ) . map ( |block| block. clone ( ) . into ( ) ) . collect ( )
419
413
}
420
414
421
415
pub fn serialized_transactions ( & self ) -> Vec < SerializableTransaction > {
You can’t perform that action at this time.
0 commit comments