Merge pull request #2444 from karalabe/gethrpctest-chainconfig-panic

cmd/gethrpctest: add missing chain configuration config field
This commit is contained in:
Péter Szilágyi 2016-04-12 17:01:51 +03:00
commit 33e4f51749
2 changed files with 7 additions and 0 deletions

View File

@ -26,11 +26,13 @@ import (
"github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/tests" "github.com/ethereum/go-ethereum/tests"
"github.com/ethereum/go-ethereum/whisper" "github.com/ethereum/go-ethereum/whisper"
) )
@ -129,6 +131,7 @@ func MakeSystemNode(keydir string, privkey string, test *tests.BlockTest) (*node
ethConf := &eth.Config{ ethConf := &eth.Config{
TestGenesisState: db, TestGenesisState: db,
TestGenesisBlock: test.Genesis, TestGenesisBlock: test.Genesis,
ChainConfig: &core.ChainConfig{HomesteadBlock: params.MainNetHomesteadBlock},
AccountManager: accman, AccountManager: accman,
} }
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { return eth.New(ctx, ethConf) }); err != nil { if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { return eth.New(ctx, ethConf) }); err != nil {

View File

@ -19,6 +19,7 @@ package eth
import ( import (
"bytes" "bytes"
"errors"
"fmt" "fmt"
"math/big" "math/big"
"os" "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") 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 = config.ChainConfig
eth.chainConfig.VmConfig = vm.Config{ eth.chainConfig.VmConfig = vm.Config{
EnableJit: config.EnableJit, EnableJit: config.EnableJit,