aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils/flags.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/utils/flags.go')
-rw-r--r--cmd/utils/flags.go45
1 files changed, 23 insertions, 22 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index e7b30cfa0..af2929d10 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -21,30 +21,32 @@ import (
"fmt"
"log"
"math/big"
+ "net"
"net/http"
"os"
"path/filepath"
"runtime"
"strconv"
- "github.com/ethereum/go-ethereum/core/vm"
- "github.com/ethereum/go-ethereum/metrics"
-
"github.com/codegangsta/cli"
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
+ "github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/rpc/api"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/comms"
+ "github.com/ethereum/go-ethereum/rpc/shared"
+ "github.com/ethereum/go-ethereum/rpc/useragent"
"github.com/ethereum/go-ethereum/xeth"
)
@@ -452,29 +454,23 @@ func SetupLogger(ctx *cli.Context) {
// SetupVM configured the VM package's global settings
func SetupVM(ctx *cli.Context) {
- vm.DisableJit = !ctx.GlobalBool(VMEnableJitFlag.Name)
+ vm.EnableJit = ctx.GlobalBool(VMEnableJitFlag.Name)
vm.ForceJit = ctx.GlobalBool(VMForceJitFlag.Name)
vm.SetJITCacheSize(ctx.GlobalInt(VMJitCacheFlag.Name))
}
// MakeChain creates a chain manager from set command line flags.
-func MakeChain(ctx *cli.Context) (chain *core.ChainManager, blockDB, stateDB, extraDB common.Database) {
+func MakeChain(ctx *cli.Context) (chain *core.ChainManager, chainDb common.Database) {
datadir := ctx.GlobalString(DataDirFlag.Name)
cache := ctx.GlobalInt(CacheFlag.Name)
var err error
- if blockDB, err = ethdb.NewLDBDatabase(filepath.Join(datadir, "blockchain"), cache); err != nil {
- Fatalf("Could not open database: %v", err)
- }
- if stateDB, err = ethdb.NewLDBDatabase(filepath.Join(datadir, "state"), cache); err != nil {
- Fatalf("Could not open database: %v", err)
- }
- if extraDB, err = ethdb.NewLDBDatabase(filepath.Join(datadir, "extra"), cache); err != nil {
+ if chainDb, err = ethdb.NewLDBDatabase(filepath.Join(datadir, "chaindata"), cache); err != nil {
Fatalf("Could not open database: %v", err)
}
if ctx.GlobalBool(OlympicFlag.Name) {
InitOlympic()
- _, err := core.WriteTestNetGenesisBlock(stateDB, blockDB, 42)
+ _, err := core.WriteTestNetGenesisBlock(chainDb, 42)
if err != nil {
glog.Fatalln(err)
}
@@ -483,14 +479,14 @@ func MakeChain(ctx *cli.Context) (chain *core.ChainManager, blockDB, stateDB, ex
eventMux := new(event.TypeMux)
pow := ethash.New()
//genesis := core.GenesisBlock(uint64(ctx.GlobalInt(GenesisNonceFlag.Name)), blockDB)
- chain, err = core.NewChainManager(blockDB, stateDB, extraDB, pow, eventMux)
+ chain, err = core.NewChainManager(chainDb, pow, eventMux)
if err != nil {
Fatalf("Could not start chainmanager: %v", err)
}
- proc := core.NewBlockProcessor(stateDB, extraDB, pow, chain, eventMux)
+ proc := core.NewBlockProcessor(chainDb, pow, chain, eventMux)
chain.SetProcessor(proc)
- return chain, blockDB, stateDB, extraDB
+ return chain, chainDb
}
// MakeChain creates an account manager from set command line flags.
@@ -524,15 +520,20 @@ func StartIPC(eth *eth.Ethereum, ctx *cli.Context) error {
Endpoint: IpcSocketPath(ctx),
}
- xeth := xeth.New(eth, nil)
- codec := codec.JSON
+ initializer := func(conn net.Conn) (shared.EthereumApi, error) {
+ fe := useragent.NewRemoteFrontend(conn, eth.AccountManager())
+ xeth := xeth.New(eth, fe)
+ codec := codec.JSON
- apis, err := api.ParseApiString(ctx.GlobalString(IPCApiFlag.Name), codec, xeth, eth)
- if err != nil {
- return err
+ apis, err := api.ParseApiString(ctx.GlobalString(IPCApiFlag.Name), codec, xeth, eth)
+ if err != nil {
+ return nil, err
+ }
+
+ return api.Merge(apis...), nil
}
- return comms.StartIpc(config, codec, api.Merge(apis...))
+ return comms.StartIpc(config, codec.JSON, initializer)
}
func StartRPC(eth *eth.Ethereum, ctx *cli.Context) error {