mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core: avoid limit lower than MinGasLimit
if accidentally get a wrong value for gasFloor/gasCeil
This commit is contained in:
parent
c8c3ebd593
commit
cd003c2868
1 changed files with 6 additions and 3 deletions
|
|
@ -120,9 +120,7 @@ func CalcGasLimit(parent *types.Block, gasFloor, gasCeil uint64) uint64 {
|
||||||
from parentGasLimit * (2/3) parentGasUsed is.
|
from parentGasLimit * (2/3) parentGasUsed is.
|
||||||
*/
|
*/
|
||||||
limit := parent.GasLimit() - decay + contrib
|
limit := parent.GasLimit() - decay + contrib
|
||||||
if limit < params.MinGasLimit {
|
|
||||||
limit = params.MinGasLimit
|
|
||||||
}
|
|
||||||
// If we're outside our allowed gas range, we try to hone towards them
|
// If we're outside our allowed gas range, we try to hone towards them
|
||||||
if limit < gasFloor {
|
if limit < gasFloor {
|
||||||
limit = parent.GasLimit() + decay
|
limit = parent.GasLimit() + decay
|
||||||
|
|
@ -135,5 +133,10 @@ func CalcGasLimit(parent *types.Block, gasFloor, gasCeil uint64) uint64 {
|
||||||
limit = gasCeil
|
limit = gasCeil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if limit < params.MinGasLimit {
|
||||||
|
limit = params.MinGasLimit
|
||||||
|
}
|
||||||
|
|
||||||
return limit
|
return limit
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue