From 312263c7d9457fe7c24aac8e42a4cf2efc6ccd8e Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 15 Aug 2016 18:38:32 +0200 Subject: cmd/utils, node: create account manager in package node The account manager was previously created by packge cmd/utils as part of flag processing and then passed down into eth.Ethereum through its config struct. Since we are starting to create nodes which do not have eth.Ethereum as a registered service, the code was rearranged to register the account manager as its own service. Making it a service is ugly though and it doesn't really fix the root cause: creating nodes without eth.Ethereum requires duplicating lots of code. This commit splits utils.MakeSystemNode into three functions, making creation of other node/service configurations easier. It also moves the account manager into Node so it can be used by those configurations without requiring package eth. --- node/service.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'node/service.go') diff --git a/node/service.go b/node/service.go index 4d9a6e42c..51531466b 100644 --- a/node/service.go +++ b/node/service.go @@ -20,6 +20,7 @@ import ( "path/filepath" "reflect" + "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/p2p" @@ -30,9 +31,10 @@ import ( // the protocol stack, that is passed to all constructors to be optionally used; // as well as utility methods to operate on the service environment. type ServiceContext struct { - datadir string // Data directory for protocol persistence - services map[reflect.Type]Service // Index of the already constructed services - EventMux *event.TypeMux // Event multiplexer used for decoupled notifications + datadir string // Data directory for protocol persistence + services map[reflect.Type]Service // Index of the already constructed services + EventMux *event.TypeMux // Event multiplexer used for decoupled notifications + AccountManager *accounts.Manager // Account manager created by the node. } // OpenDatabase opens an existing database with the given name (or creates one -- cgit