mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
Merge branch 'bzz' of https://github.com/ethersphere/go-ethereum into bzz
This commit is contained in:
commit
3de34b631d
5 changed files with 15 additions and 4 deletions
|
|
@ -209,6 +209,9 @@ func (self *bzzProtocol) handle() error {
|
|||
return self.protoError(ErrDecode, "->msg %v: %v", msg, err)
|
||||
}
|
||||
dpaLogger.Warnf("Request message: %#v", req)
|
||||
if req.Key == nil || req.Timeout == nil {
|
||||
return self.protoError(ErrDecode, "protocol handler: req.Key == nil || req.Timeout == nil")
|
||||
}
|
||||
req.peer = peer{bzzProtocol: self}
|
||||
self.netStore.addRetrieveRequest(&req)
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ var (
|
|||
SHH bool
|
||||
Dial bool
|
||||
PrintVersion bool
|
||||
Peers string
|
||||
)
|
||||
|
||||
// flags specific to cli client
|
||||
|
|
@ -103,6 +104,7 @@ func Init() {
|
|||
flag.BoolVar(&SHH, "shh", true, "whisper protocol (on)")
|
||||
flag.BoolVar(&Dial, "dial", true, "dial out connections (on)")
|
||||
flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key")
|
||||
flag.StringVar(&Peers, "peers", "", "imports the file given (hex or mnemonic formats)")
|
||||
flag.StringVar(&SecretFile, "import", "", "imports the file given (hex or mnemonic formats)")
|
||||
flag.StringVar(&ExportDir, "export", "", "exports the session keyring to files in the directory given")
|
||||
flag.StringVar(&LogFile, "logfile", "", "log file (defaults to standard output)")
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ func main() {
|
|||
utils.StartWebSockets(ethereum)
|
||||
}
|
||||
|
||||
utils.StartEthereum(ethereum, UseSeed)
|
||||
utils.StartEthereum(ethereum, UseSeed, Peers)
|
||||
|
||||
if StartJsConsole {
|
||||
InitJsConsole(ethereum)
|
||||
|
|
|
|||
|
|
@ -120,9 +120,9 @@ func exit(err error) {
|
|||
os.Exit(status)
|
||||
}
|
||||
|
||||
func StartEthereum(ethereum *eth.Ethereum, UseSeed bool) {
|
||||
func StartEthereum(ethereum *eth.Ethereum, UseSeed bool, Peers string) {
|
||||
clilogger.Infof("Starting %s", ethereum.ClientIdentity())
|
||||
err := ethereum.Start(UseSeed)
|
||||
err := ethereum.Start(UseSeed, Peers)
|
||||
if err != nil {
|
||||
exit(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ func (s *Ethereum) MaxPeers() int {
|
|||
}
|
||||
|
||||
// Start the ethereum
|
||||
func (s *Ethereum) Start(seed bool) error {
|
||||
func (s *Ethereum) Start(seed bool, p string) error {
|
||||
err := s.net.Start()
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -255,6 +255,12 @@ func (s *Ethereum) Start(seed bool) error {
|
|||
s.blockSub = s.eventMux.Subscribe(core.NewMinedBlockEvent{})
|
||||
go s.blockBroadcastLoop()
|
||||
|
||||
if len(p) > 0 {
|
||||
if err := s.SuggestPeer(p); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: read peers here
|
||||
if seed {
|
||||
logger.Infof("Connect to seed node %v", seedNodeAddress)
|
||||
|
|
|
|||
Loading…
Reference in a new issue