fix ensure min target ratio when blocks use none/very-little gas

This commit is contained in:
Jared Wasinger 2025-04-24 18:19:30 +08:00
parent 03b8cc8eb9
commit 8b7f061b12

View file

@ -72,9 +72,8 @@ func (r *resultStore) SetThrottleTarget(targetRatio common.StorageSize) uint64 {
if r.pendingCount == 0 { if r.pendingCount == 0 {
return r.throttleThreshold return r.throttleThreshold
} }
if targetRatio == 0 { targetRatio = max(targetRatio, 0.1)
targetRatio = 0.1 // TODO: more informed choice of a minimum here?
}
// use the target ratio to determine // use the target ratio to determine
// (pendingGasUsed / target) <- estimated total size of collective in-flight retrievals // (pendingGasUsed / target) <- estimated total size of collective in-flight retrievals
estBlockSize := common.StorageSize(r.pendingGasUsed/uint64(r.pendingCount)) / targetRatio estBlockSize := common.StorageSize(r.pendingGasUsed/uint64(r.pendingCount)) / targetRatio