aboutsummaryrefslogtreecommitdiffstats
path: root/javascript
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-02-05 10:16:16 +0800
committerFelix Lange <fjl@twurst.com>2015-02-06 07:03:59 +0800
commit56f777b2fc77275bc636562b66a08b19afe2ec56 (patch)
treec9a34bd23e13adb0d850957b9a66cd748d34b3e3 /javascript
parent8e8ec8f5f8974aafeac5e4a9ead76878fe22cefd (diff)
downloadgo-tangerine-56f777b2fc77275bc636562b66a08b19afe2ec56.tar.gz
go-tangerine-56f777b2fc77275bc636562b66a08b19afe2ec56.tar.zst
go-tangerine-56f777b2fc77275bc636562b66a08b19afe2ec56.zip
cmd/ethereum, cmd/mist, core, eth, javascript, xeth: fixes for new p2p API
Diffstat (limited to 'javascript')
-rw-r--r--javascript/javascript_runtime.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/javascript/javascript_runtime.go b/javascript/javascript_runtime.go
index 398daf43a..a09aff027 100644
--- a/javascript/javascript_runtime.go
+++ b/javascript/javascript_runtime.go
@@ -14,6 +14,7 @@ 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"
@@ -201,8 +202,15 @@ func (self *JSRE) addPeer(call otto.FunctionCall) otto.Value {
if err != nil {
return otto.FalseValue()
}
- self.ethereum.SuggestPeer(host)
-
+ idstr, err := call.Argument(0).ToString()
+ if err != nil {
+ return otto.FalseValue()
+ }
+ id, err := discover.HexID(idstr)
+ if err != nil {
+ return otto.FalseValue()
+ }
+ self.ethereum.SuggestPeer(host, id)
return otto.TrueValue()
}