diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-11-15 20:46:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-15 20:46:47 +0800 |
commit | 81d9d7d38555a63602b9da3d07955ad4e5a62f02 (patch) | |
tree | 9ce0d55bfe182f6493867ea5497bf2c8cd9e8523 /core/database_util.go | |
parent | ef9265d0d7abf6614c1d2fb977989ab0d400a590 (diff) | |
parent | 822355f8a6e8826561433392fd94a8bde7e4dbf3 (diff) | |
download | go-tangerine-1.4.19.tar go-tangerine-1.4.19.tar.gz go-tangerine-1.4.19.tar.bz2 go-tangerine-1.4.19.tar.lz go-tangerine-1.4.19.tar.xz go-tangerine-1.4.19.tar.zst go-tangerine-1.4.19.zip |
Merge pull request #3252 from obscuren/release/1.4v1.4.19
1.4 HF
Diffstat (limited to 'core/database_util.go')
-rw-r--r-- | core/database_util.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/database_util.go b/core/database_util.go index 3a110f7d0..62521cba6 100644 --- a/core/database_util.go +++ b/core/database_util.go @@ -20,6 +20,7 @@ import ( "bytes" "encoding/binary" "encoding/json" + "errors" "fmt" "math/big" @@ -28,6 +29,7 @@ import ( "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" + "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rlp" ) @@ -52,7 +54,8 @@ var ( blockHashPrefix = []byte("block-hash-") // [deprecated by the header/block split, remove eventually] - configPrefix = []byte("ethereum-config-") // config prefix for the db + configPrefix = []byte("ethereum-config-") // config prefix for the db + ChainConfigNotFoundErr = errors.New("ChainConfig not found") // general config not found error ) // GetCanonicalHash retrieves a hash assigned to a canonical block number. @@ -536,7 +539,7 @@ func WriteBlockChainVersion(db ethdb.Database, vsn int) { } // WriteChainConfig writes the chain config settings to the database. -func WriteChainConfig(db ethdb.Database, hash common.Hash, cfg *ChainConfig) error { +func WriteChainConfig(db ethdb.Database, hash common.Hash, cfg *params.ChainConfig) error { // short circuit and ignore if nil config. GetChainConfig // will return a default. if cfg == nil { @@ -552,13 +555,13 @@ func WriteChainConfig(db ethdb.Database, hash common.Hash, cfg *ChainConfig) err } // GetChainConfig will fetch the network settings based on the given hash. -func GetChainConfig(db ethdb.Database, hash common.Hash) (*ChainConfig, error) { +func GetChainConfig(db ethdb.Database, hash common.Hash) (*params.ChainConfig, error) { jsonChainConfig, _ := db.Get(append(configPrefix, hash[:]...)) if len(jsonChainConfig) == 0 { return nil, ChainConfigNotFoundErr } - var config ChainConfig + var config params.ChainConfig if err := json.Unmarshal(jsonChainConfig, &config); err != nil { return nil, err } |