update gas limit as per quorum upstream

This commit is contained in:
amalraj.manigmail.com 2018-11-22 15:41:04 +08:00
parent 434c1f7f75
commit 8438d79754
1 changed files with 3 additions and 3 deletions

View File

@ -106,10 +106,10 @@ func (v *BlockValidator) ValidateState(block, parent *types.Block, statedb *stat
// CalcGasLimit computes the gas limit of the next block after parent.
// This is miner strategy, not consensus protocol.
func CalcGasLimit(parent *types.Block) uint64 {
// contrib = (parentGasUsed * 3 / 2) / 1024
// contrib = (parentGasUsed * 3 / 2) / 4096
contrib := (parent.GasUsed() + parent.GasUsed()/2) / params.GasLimitBoundDivisor
// decay = parentGasLimit / 1024 -1
// decay = parentGasLimit / 4096 -1
decay := parent.GasLimit()/params.GasLimitBoundDivisor - 1
/*
@ -124,7 +124,7 @@ func CalcGasLimit(parent *types.Block) uint64 {
limit = params.MinGasLimit
}
// however, if we're now below the target (TargetGasLimit) we increase the
// limit as much as we can (parentGasLimit / 1024 -1)
// limit as much as we can (parentGasLimit / 4096 -1)
if limit < params.TargetGasLimit {
limit = parent.GasLimit() + decay
if limit > params.TargetGasLimit {