From 2b2bcf4902d4b52f9c9be5fe4db55956418dafa7 Mon Sep 17 00:00:00 2001 From: Ian Norden Date: Thu, 5 Dec 2019 14:20:51 -0600 Subject: [PATCH] adjust verifyHeaders to validate GasLimit as calculated by new CalcGasLimitAndBaseFee function --- core/block_validator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/block_validator.go b/core/block_validator.go index af8a77c92..c51b504fc 100644 --- a/core/block_validator.go +++ b/core/block_validator.go @@ -168,7 +168,7 @@ func calcGasLimitAndBaseFee(config *params.ChainConfig, parent *types.Block) (ui div := new(big.Int).Div(mul, new(big.Int).SetUint64(params.TargetGasUsed)) div2 := new(big.Int).Div(div, new(big.Int).SetUint64(params.BaseFeeMaxChangeDenominator)) baseFee := new(big.Int).Add(parent.BaseFee(), div2) - + // A valid BASEFEE is one such that abs(BASEFEE - PARENT_BASEFEE) <= max(1, PARENT_BASEFEE // BASEFEE_MAX_CHANGE_DENOMINATOR) diff := new(big.Int).Sub(baseFee, parent.BaseFee()) neg := false