mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
prevent divide by zero
This commit is contained in:
parent
e703f92416
commit
7f0adc0bcb
1 changed files with 1 additions and 1 deletions
|
|
@ -100,7 +100,7 @@ func (r *resultStore) getFetchResult(headerNumber uint64) (item *fetchResult, in
|
|||
// estimate an average block size based on the worst case:
|
||||
// a block filled with calldata containing all zeroes
|
||||
// costing ~10 gas per byte of calldata.
|
||||
avgEstimatedBlockSize := (r.itemsGasUsed / (uint64(index) + 1)) / 10
|
||||
avgEstimatedBlockSize := min((r.itemsGasUsed/(uint64(index)+1))/10, 524)
|
||||
|
||||
throttleThreshold := min(uint64(len(r.items)), uint64(blockCacheMemory)/avgEstimatedBlockSize)
|
||||
throttle = index >= int(throttleThreshold)
|
||||
|
|
|
|||
Loading…
Reference in a new issue