diff options
Diffstat (limited to 'core/config.go')
-rw-r--r-- | core/config.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/config.go b/core/config.go index c0d065a57..3ab04e520 100644 --- a/core/config.go +++ b/core/config.go @@ -21,6 +21,7 @@ import ( "math/big" "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/params" ) var ChainConfigNotFoundErr = errors.New("ChainConfig not found") // general config not found error @@ -35,6 +36,8 @@ type ChainConfig struct { DAOForkBlock *big.Int `json:"daoForkBlock"` // TheDAO hard-fork switch block (nil = no fork) DAOForkSupport bool `json:"daoForkSupport"` // Whether the nodes supports or opposes the DAO hard-fork + HomesteadGasRepriceBlock *big.Int `json:"homesteadGasRepriceBlock"` // Homestead gas reprice switch block (nil = no fork) + VmConfig vm.Config `json:"-"` } @@ -45,3 +48,14 @@ func (c *ChainConfig) IsHomestead(num *big.Int) bool { } return num.Cmp(c.HomesteadBlock) >= 0 } + +// GasTable returns the gas table corresponding to the current phase (homestead or homestead reprice). +// +// The returned GasTable's fields shouldn't, under any circumstances, be changed. +func (c *ChainConfig) GasTable(num *big.Int) params.GasTable { + if c.HomesteadGasRepriceBlock == nil || num == nil || num.Cmp(c.HomesteadGasRepriceBlock) < 0 { + return params.GasTableHomestead + } + + return params.GasTableHomesteadGasRepriceFork +} |