From 90279812804cdca04a12955b83f91fbebb661082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Tue, 12 Apr 2016 16:44:42 +0300 Subject: [PATCH 1/2] cmd/gethrpctest: add missing chain configuration config field --- cmd/gethrpctest/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/gethrpctest/main.go b/cmd/gethrpctest/main.go index 38016fb35..4843f8658 100644 --- a/cmd/gethrpctest/main.go +++ b/cmd/gethrpctest/main.go @@ -26,11 +26,13 @@ import ( "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/node" + "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/tests" "github.com/ethereum/go-ethereum/whisper" ) @@ -129,6 +131,7 @@ func MakeSystemNode(keydir string, privkey string, test *tests.BlockTest) (*node ethConf := ð.Config{ TestGenesisState: db, TestGenesisBlock: test.Genesis, + ChainConfig: &core.ChainConfig{HomesteadBlock: params.MainNetHomesteadBlock}, AccountManager: accman, } if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { return eth.New(ctx, ethConf) }); err != nil { From aceaaa517834fa8dfc5121b66dfd633f0b10ca8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Tue, 12 Apr 2016 16:48:43 +0300 Subject: [PATCH 2/2] eth: gracefully fail if chain config is missing --- eth/backend.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eth/backend.go b/eth/backend.go index f4282d59f..cab83588c 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -19,6 +19,7 @@ package eth import ( "bytes" + "errors" "fmt" "math/big" "os" @@ -243,6 +244,9 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { glog.V(logger.Info).Infoln("WARNING: Wrote default ethereum genesis block") } + if config.ChainConfig == nil { + return nil, errors.New("missing chain config") + } eth.chainConfig = config.ChainConfig eth.chainConfig.VmConfig = vm.Config{ EnableJit: config.EnableJit,