File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -206,10 +206,10 @@ impl<E: EthSpec> StateCache<E> {
206
206
// Do not attempt to rebase states prior to the finalized state. This method might be called
207
207
// with states on the hdiff grid prior to finalization, as part of the reconstruction of
208
208
// some later unfinalized state.
209
- if let Some ( finalized_state) = & self . finalized_state {
210
- if state. slot ( ) >= finalized_state. state . slot ( ) {
211
- state . rebase_on ( & finalized_state . state , spec ) ? ;
212
- }
209
+ if let Some ( finalized_state) = & self . finalized_state
210
+ && state. slot ( ) >= finalized_state. state . slot ( )
211
+ {
212
+ state . rebase_on ( & finalized_state . state , spec ) ? ;
213
213
}
214
214
215
215
Ok ( ( ) )
@@ -436,7 +436,7 @@ impl<E: EthSpec> StateCache<E> {
436
436
// }
437
437
for ( _, ( _, state) ) in & self . states {
438
438
total_bytes += tracker
439
- . track_item ( & BeaconStateWrapper ( & state) )
439
+ . track_item ( & BeaconStateWrapper ( state) )
440
440
. differential_size ;
441
441
}
442
442
@@ -454,7 +454,7 @@ impl<E: EthSpec> StateCache<E> {
454
454
total_bytes as i64 ,
455
455
) ;
456
456
457
- let batch = self . headroom . get ( ) . max ( 5 ) . min ( 64 ) ; // tune batch size
457
+ let batch = self . headroom . get ( ) . clamp ( 5 , 64 ) ; // tune batch size
458
458
459
459
while total_bytes > self . max_cached_bytes {
460
460
// Cull the cache until we are under the max_cached_bytes limit.
Original file line number Diff line number Diff line change @@ -380,6 +380,9 @@ Options:
380
380
--state-cache-headroom <N>
381
381
Minimum number of states to cull from the state cache when it gets
382
382
full [default: 1]
383
+ --state-cache-max-bytes <BYTES>
384
+ Specifies the maximum size of the state cache in bytes [default:
385
+ 536870912]
383
386
--state-cache-size <STATE_CACHE_SIZE>
384
387
Specifies the size of the state cache [default: 128]
385
388
--suggested-fee-recipient <SUGGESTED-FEE-RECIPIENT>
You can’t perform that action at this time.
0 commit comments