diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-06-30 17:57:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-30 17:57:50 +0800 |
commit | 1e50f5dd281d28b8db1c65b9e80e53080b86e369 (patch) | |
tree | 30a0832e6f514fe06fe9308043eaa20d2ba44b13 /cmd | |
parent | f127799d795eaf2d6f99780c058361cd561492f1 (diff) | |
parent | 3a97280ae889bb6852ba16e70750a37b2ed08473 (diff) | |
download | dexon-1e50f5dd281d28b8db1c65b9e80e53080b86e369.tar.gz dexon-1e50f5dd281d28b8db1c65b9e80e53080b86e369.tar.zst dexon-1e50f5dd281d28b8db1c65b9e80e53080b86e369.zip |
Merge pull request #2159 from zsfelfoldi/light-backend
eth: separate common and full node-specific API and backend service
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/geth/main.go | 10 | ||||
-rw-r--r-- | cmd/gethrpctest/main.go | 2 | ||||
-rw-r--r-- | cmd/utils/flags.go | 7 |
3 files changed, 15 insertions, 4 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go index c372430f1..623f8ac81 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -29,6 +29,7 @@ import ( "time" "github.com/ethereum/ethash" + "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/console" @@ -313,11 +314,10 @@ func startNode(ctx *cli.Context, stack *node.Node) { utils.StartNode(stack) // Unlock any account specifically requested - var ethereum *eth.Ethereum - if err := stack.Service(ðereum); err != nil { + var accman *accounts.Manager + if err := stack.Service(&accman); err != nil { utils.Fatalf("ethereum service not running: %v", err) } - accman := ethereum.AccountManager() passwords := utils.MakePasswordList(ctx) accounts := strings.Split(ctx.GlobalString(utils.UnlockedAccountFlag.Name), ",") @@ -328,6 +328,10 @@ func startNode(ctx *cli.Context, stack *node.Node) { } // Start auxiliary services if enabled if ctx.GlobalBool(utils.MiningEnabledFlag.Name) { + var ethereum *eth.FullNodeService + if err := stack.Service(ðereum); err != nil { + utils.Fatalf("ethereum service not running: %v", err) + } if err := ethereum.StartMining(ctx.GlobalInt(utils.MinerThreadsFlag.Name), ctx.GlobalString(utils.MiningGPUFlag.Name)); err != nil { utils.Fatalf("Failed to start mining: %v", err) } diff --git a/cmd/gethrpctest/main.go b/cmd/gethrpctest/main.go index 2e07e9426..668efbfc7 100644 --- a/cmd/gethrpctest/main.go +++ b/cmd/gethrpctest/main.go @@ -146,7 +146,7 @@ func MakeSystemNode(keydir string, privkey string, test *tests.BlockTest) (*node // RunTest executes the specified test against an already pre-configured protocol // stack to ensure basic checks pass before running RPC tests. func RunTest(stack *node.Node, test *tests.BlockTest) error { - var ethereum *eth.Ethereum + var ethereum *eth.FullNodeService stack.Service(ðereum) blockchain := ethereum.BlockChain() diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 14898b987..38ba3a9ba 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -763,6 +763,13 @@ func MakeSystemNode(name, version string, relconf release.Config, extra []byte, if err != nil { Fatalf("Failed to create the protocol stack: %v", err) } + + if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { + return accman, nil + }); err != nil { + Fatalf("Failed to register the account manager service: %v", err) + } + if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { return eth.New(ctx, ethConf) }); err != nil { |