mirror of https://github.com/status-im/op-geth.git
Merge pull request #287 from ethereum/system-testing
Seednode CLI param updates
This commit is contained in:
commit
99a1551b20
|
@ -49,7 +49,7 @@ var (
|
||||||
AddPeer string
|
AddPeer string
|
||||||
MaxPeer int
|
MaxPeer int
|
||||||
GenAddr bool
|
GenAddr bool
|
||||||
UseSeed bool
|
SeedNode string
|
||||||
SecretFile string
|
SecretFile string
|
||||||
ExportDir string
|
ExportDir string
|
||||||
NonInteractive bool
|
NonInteractive bool
|
||||||
|
@ -101,7 +101,7 @@ func Init() {
|
||||||
flag.BoolVar(&StartRpc, "rpc", false, "start rpc server")
|
flag.BoolVar(&StartRpc, "rpc", false, "start rpc server")
|
||||||
flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server")
|
flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server")
|
||||||
flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)")
|
flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)")
|
||||||
flag.BoolVar(&UseSeed, "seed", true, "seed peers")
|
flag.StringVar(&SeedNode, "seednode", "poc-8.ethdev.com:30303", "ip:port of seed node to connect to. Set to blank for skip")
|
||||||
flag.BoolVar(&SHH, "shh", true, "whisper protocol (on)")
|
flag.BoolVar(&SHH, "shh", true, "whisper protocol (on)")
|
||||||
flag.BoolVar(&Dial, "dial", true, "dial out connections (on)")
|
flag.BoolVar(&Dial, "dial", true, "dial out connections (on)")
|
||||||
flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key")
|
flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key")
|
||||||
|
|
|
@ -134,7 +134,7 @@ func main() {
|
||||||
utils.StartWebSockets(ethereum, WsPort)
|
utils.StartWebSockets(ethereum, WsPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
utils.StartEthereum(ethereum, UseSeed)
|
utils.StartEthereum(ethereum, SeedNode)
|
||||||
|
|
||||||
if StartJsConsole {
|
if StartJsConsole {
|
||||||
InitJsConsole(ethereum)
|
InitJsConsole(ethereum)
|
||||||
|
|
|
@ -51,7 +51,7 @@ var (
|
||||||
AddPeer string
|
AddPeer string
|
||||||
MaxPeer int
|
MaxPeer int
|
||||||
GenAddr bool
|
GenAddr bool
|
||||||
UseSeed bool
|
SeedNode string
|
||||||
SecretFile string
|
SecretFile string
|
||||||
ExportDir string
|
ExportDir string
|
||||||
NonInteractive bool
|
NonInteractive bool
|
||||||
|
@ -116,7 +116,7 @@ func Init() {
|
||||||
flag.BoolVar(&StartRpc, "rpc", true, "start rpc server")
|
flag.BoolVar(&StartRpc, "rpc", true, "start rpc server")
|
||||||
flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server")
|
flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server")
|
||||||
flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)")
|
flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)")
|
||||||
flag.BoolVar(&UseSeed, "seed", true, "seed peers")
|
flag.StringVar(&SeedNode, "seednode", "poc-8.ethdev.com:30303", "ip:port of seed node to connect to. Set to blank for skip")
|
||||||
flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key")
|
flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key")
|
||||||
flag.StringVar(&NatType, "nat", "", "NAT support (UPNP|PMP) (none)")
|
flag.StringVar(&NatType, "nat", "", "NAT support (UPNP|PMP) (none)")
|
||||||
flag.StringVar(&SecretFile, "import", "", "imports the file given (hex or mnemonic formats)")
|
flag.StringVar(&SecretFile, "import", "", "imports the file given (hex or mnemonic formats)")
|
||||||
|
|
|
@ -84,7 +84,7 @@ func run() error {
|
||||||
utils.RegisterInterrupt(func(os.Signal) {
|
utils.RegisterInterrupt(func(os.Signal) {
|
||||||
gui.Stop()
|
gui.Stop()
|
||||||
})
|
})
|
||||||
go utils.StartEthereum(ethereum, UseSeed)
|
go utils.StartEthereum(ethereum, SeedNode)
|
||||||
|
|
||||||
fmt.Println("ETH stack took", time.Since(tstart))
|
fmt.Println("ETH stack took", time.Since(tstart))
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ func (ui *UiLib) Muted(content string) {
|
||||||
|
|
||||||
func (ui *UiLib) Connect(button qml.Object) {
|
func (ui *UiLib) Connect(button qml.Object) {
|
||||||
if !ui.connected {
|
if !ui.connected {
|
||||||
ui.eth.Start(true)
|
ui.eth.Start(SeedNode)
|
||||||
ui.connected = true
|
ui.connected = true
|
||||||
button.Set("enabled", false)
|
button.Set("enabled", false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,9 +121,9 @@ func exit(err error) {
|
||||||
os.Exit(status)
|
os.Exit(status)
|
||||||
}
|
}
|
||||||
|
|
||||||
func StartEthereum(ethereum *eth.Ethereum, UseSeed bool) {
|
func StartEthereum(ethereum *eth.Ethereum, SeedNode string) {
|
||||||
clilogger.Infof("Starting %s", ethereum.ClientIdentity())
|
clilogger.Infof("Starting %s", ethereum.ClientIdentity())
|
||||||
err := ethereum.Start(UseSeed)
|
err := ethereum.Start(SeedNode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exit(err)
|
exit(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/whisper"
|
"github.com/ethereum/go-ethereum/whisper"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
seedNodeAddress = "poc-8.ethdev.com:30303"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Name string
|
Name string
|
||||||
Version string
|
Version string
|
||||||
|
@ -223,7 +219,7 @@ func (s *Ethereum) Coinbase() []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the ethereum
|
// Start the ethereum
|
||||||
func (s *Ethereum) Start(seed bool) error {
|
func (s *Ethereum) Start(seedNode string) error {
|
||||||
err := s.net.Start()
|
err := s.net.Start()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -246,9 +242,9 @@ func (s *Ethereum) Start(seed bool) error {
|
||||||
go s.blockBroadcastLoop()
|
go s.blockBroadcastLoop()
|
||||||
|
|
||||||
// TODO: read peers here
|
// TODO: read peers here
|
||||||
if seed {
|
if len(seedNode) > 0 {
|
||||||
logger.Infof("Connect to seed node %v", seedNodeAddress)
|
logger.Infof("Connect to seed node %v", seedNode)
|
||||||
if err := s.SuggestPeer(seedNodeAddress); err != nil {
|
if err := s.SuggestPeer(seedNode); err != nil {
|
||||||
logger.Infoln(err)
|
logger.Infoln(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue