diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-10-15 00:32:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-15 00:32:11 +0800 |
commit | 81b01f1c2bba8340f9cf2bf1da8ef131e3decd50 (patch) | |
tree | 0b2269cb3dfa9719cf3bf7a828c49b0c1ffccab8 /core/config.go | |
parent | a4d9e63d12c80a14294c0d085de6bf711ceec779 (diff) | |
parent | 64af2aafdaf16d0bab4c2b89573324b076602bab (diff) | |
download | dexon-81b01f1c2bba8340f9cf2bf1da8ef131e3decd50.tar dexon-81b01f1c2bba8340f9cf2bf1da8ef131e3decd50.tar.gz dexon-81b01f1c2bba8340f9cf2bf1da8ef131e3decd50.tar.bz2 dexon-81b01f1c2bba8340f9cf2bf1da8ef131e3decd50.tar.lz dexon-81b01f1c2bba8340f9cf2bf1da8ef131e3decd50.tar.xz dexon-81b01f1c2bba8340f9cf2bf1da8ef131e3decd50.tar.zst dexon-81b01f1c2bba8340f9cf2bf1da8ef131e3decd50.zip |
Merge pull request #3111 from obscuren/gas-price-fork
core, core/vm: added gas price variance table (EIP #150)
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 +} |