cmd/mist, eth, javascript, p2p: use Node URLs for peer suggestions

This commit is contained in:
Felix Lange
2015-02-07 00:15:04 +01:00
parent e34d134102
commit 2cf4fed11b
6 changed files with 21 additions and 62 deletions

View File

@ -14,7 +14,6 @@ import (
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/xeth"
"github.com/obscuren/otto"
@ -198,19 +197,13 @@ func (self *JSRE) watch(call otto.FunctionCall) otto.Value {
}
func (self *JSRE) addPeer(call otto.FunctionCall) otto.Value {
host, err := call.Argument(0).ToString()
nodeURL, err := call.Argument(0).ToString()
if err != nil {
return otto.FalseValue()
}
idstr, err := call.Argument(0).ToString()
if err != nil {
if err := self.ethereum.SuggestPeer(nodeURL); err != nil {
return otto.FalseValue()
}
id, err := discover.HexID(idstr)
if err != nil {
return otto.FalseValue()
}
self.ethereum.SuggestPeer(host, id)
return otto.TrueValue()
}