diff options
author | zelig <viktor.tron@gmail.com> | 2014-07-04 00:36:24 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2014-07-04 00:36:24 +0800 |
commit | 9de30d96f0362bc885d75a27bbd9c3d02af2d983 (patch) | |
tree | ececb77916fabbadff279fb2636ecd759afd9057 /utils | |
parent | a3c482351114404a4568f4b3f4503182402dc6fd (diff) | |
download | dexon-9de30d96f0362bc885d75a27bbd9c3d02af2d983.tar.gz dexon-9de30d96f0362bc885d75a27bbd9c3d02af2d983.tar.zst dexon-9de30d96f0362bc885d75a27bbd9c3d02af2d983.zip |
Modify main wrappers
- clientIdentifier now set in main wrappers
- version handled within wrapper
- modify InitConfig now returning *ethutil.ConfigManager (passed to gui)
- added NewClientIdentity returning *ethwire.SimpleClientIdentiy (passed to ethereum)
Diffstat (limited to 'utils')
-rw-r--r-- | utils/cmd.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/utils/cmd.go b/utils/cmd.go index e10addf6c..889726b04 100644 --- a/utils/cmd.go +++ b/utils/cmd.go @@ -10,6 +10,7 @@ import ( "github.com/ethereum/eth-go/ethpub" "github.com/ethereum/eth-go/ethrpc" "github.com/ethereum/eth-go/ethutil" + "github.com/ethereum/eth-go/ethwire" "io" "log" "os" @@ -98,9 +99,9 @@ func InitLogging(Datadir string, LogFile string, LogLevel int, DebugFile string) } } -func InitConfig(ConfigFile string, Datadir string, Identifier string, EnvPrefix string) { +func InitConfig(ConfigFile string, Datadir string, EnvPrefix string) *ethutil.ConfigManager { InitDataDir(Datadir) - ethutil.ReadConfig(ConfigFile, Datadir, Identifier, EnvPrefix) + return ethutil.ReadConfig(ConfigFile, Datadir, EnvPrefix) } func exit(err error) { @@ -122,8 +123,12 @@ func NewDatabase() ethutil.Database { return db } -func NewEthereum(db ethutil.Database, keyManager *ethcrypto.KeyManager, usePnp bool, OutboundPort string, MaxPeer int) *eth.Ethereum { - ethereum, err := eth.New(db, keyManager, eth.CapDefault, usePnp) +func NewClientIdentity(clientIdentifier, version, customIdentifier string) *ethwire.SimpleClientIdentity { + return ethwire.NewSimpleClientIdentity(clientIdentifier, version, customIdentifier) +} + +func NewEthereum(db ethutil.Database, clientIdentity ethwire.ClientIdentity, keyManager *ethcrypto.KeyManager, usePnp bool, OutboundPort string, MaxPeer int) *eth.Ethereum { + ethereum, err := eth.New(db, clientIdentity, keyManager, eth.CapDefault, usePnp) if err != nil { logger.Fatalln("eth start err:", err) } @@ -133,7 +138,7 @@ func NewEthereum(db ethutil.Database, keyManager *ethcrypto.KeyManager, usePnp b } func StartEthereum(ethereum *eth.Ethereum, UseSeed bool) { - logger.Infof("Starting Ethereum v%s", ethutil.Config.Ver) + logger.Infof("Starting %s", ethereum.ClientIdentity()) ethereum.Start(UseSeed) RegisterInterrupt(func(sig os.Signal) { ethereum.Stop() |