forked from cerc-io/plugeth
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)
This commit is contained in:
parent
a3c4823511
commit
9de30d96f0
@ -8,6 +8,11 @@ import (
|
||||
"runtime"
|
||||
)
|
||||
|
||||
const (
|
||||
ClientIdentifier = "Ethereal"
|
||||
Version = "0.5.16"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Leave QT on top at ALL times. Qt Needs to be initialized from the main thread
|
||||
qml.Init(nil)
|
||||
@ -23,7 +28,8 @@ func main() {
|
||||
|
||||
// precedence: code-internal flag default < config file < environment variables < command line
|
||||
Init() // parsing command line
|
||||
utils.InitConfig(ConfigFile, Datadir, Identifier, "ETH")
|
||||
|
||||
config := utils.InitConfig(ConfigFile, Datadir, "ETH")
|
||||
|
||||
utils.InitDataDir(Datadir)
|
||||
|
||||
@ -36,7 +42,9 @@ func main() {
|
||||
// create, import, export keys
|
||||
utils.KeyTasks(keyManager, KeyRing, GenAddr, SecretFile, ExportDir, NonInteractive)
|
||||
|
||||
ethereum := utils.NewEthereum(db, keyManager, UseUPnP, OutboundPort, MaxPeer)
|
||||
clientIdentity := utils.NewClientIdentity(ClientIdentifier, Version, Identifier)
|
||||
|
||||
ethereum := utils.NewEthereum(db, clientIdentity, keyManager, UseUPnP, OutboundPort, MaxPeer)
|
||||
|
||||
if ShowGenesis {
|
||||
utils.ShowGenesis(ethereum)
|
||||
@ -46,7 +54,7 @@ func main() {
|
||||
utils.StartRpc(ethereum, RpcPort)
|
||||
}
|
||||
|
||||
gui := NewWindow(ethereum, KeyRing, LogLevel)
|
||||
gui := NewWindow(ethereum, config, clientIdentity, KeyRing, LogLevel)
|
||||
|
||||
utils.RegisterInterrupt(func(os.Signal) {
|
||||
gui.Stop()
|
||||
|
@ -6,6 +6,11 @@ import (
|
||||
"runtime"
|
||||
)
|
||||
|
||||
const (
|
||||
ClientIdentifier = "Ethereum(G)"
|
||||
Version = "0.5.16"
|
||||
)
|
||||
|
||||
var logger = ethlog.NewLogger("CLI")
|
||||
|
||||
func main() {
|
||||
@ -15,7 +20,7 @@ func main() {
|
||||
|
||||
// precedence: code-internal flag default < config file < environment variables < command line
|
||||
Init() // parsing command line
|
||||
utils.InitConfig(ConfigFile, Datadir, Identifier, "ETH")
|
||||
utils.InitConfig(ConfigFile, Datadir, "ETH")
|
||||
|
||||
utils.InitDataDir(Datadir)
|
||||
|
||||
@ -28,7 +33,9 @@ func main() {
|
||||
// create, import, export keys
|
||||
utils.KeyTasks(keyManager, KeyRing, GenAddr, SecretFile, ExportDir, NonInteractive)
|
||||
|
||||
ethereum := utils.NewEthereum(db, keyManager, UseUPnP, OutboundPort, MaxPeer)
|
||||
clientIdentity := utils.NewClientIdentity(ClientIdentifier, Version, Identifier)
|
||||
|
||||
ethereum := utils.NewEthereum(db, clientIdentity, keyManager, UseUPnP, OutboundPort, MaxPeer)
|
||||
|
||||
if ShowGenesis {
|
||||
utils.ShowGenesis(ethereum)
|
||||
|
15
utils/cmd.go
15
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()
|
||||
|
Loading…
Reference in New Issue
Block a user