Skip to content

Commit acd3eb9

Browse files
authored
core: use max to simplify function CalcGasLimit (#1902)
1 parent 267222d commit acd3eb9

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

core/block_validator.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,7 @@ func CalcGasLimit(parent *types.Block) uint64 {
189189
at that usage) the amount increased/decreased depends on how far away
190190
from parentGasLimit * (2/3) parentGasUsed is.
191191
*/
192-
limit := parent.GasLimit() - decay + contrib
193-
if limit < params.MinGasLimit {
194-
limit = params.MinGasLimit
195-
}
192+
limit := max(parent.GasLimit()-decay+contrib, params.MinGasLimit)
196193
// however, if we're now below the target (TargetGasLimit) we increase the
197194
// limit as much as we can (parentGasLimit / 1024 -1)
198195
if limit < params.TargetGasLimit {

0 commit comments

Comments
 (0)