aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/whisperv5/api.go
diff options
context:
space:
mode:
authorJanos Guljas <janos@resenje.org>2018-09-25 22:57:31 +0800
committerJanos Guljas <janos@resenje.org>2018-09-25 22:57:31 +0800
commit24349144b6c0642755569268bab56b9033743212 (patch)
tree9d9d2b6659fd8a56512dfc807aafe4b733165ae1 /whisper/whisperv5/api.go
parent7d56602391e155e2ce9ba7c261300a1804ab9972 (diff)
parentd3441ebb563439bac0837d70591f92e2c6080303 (diff)
downloadgo-tangerine-24349144b6c0642755569268bab56b9033743212.tar
go-tangerine-24349144b6c0642755569268bab56b9033743212.tar.gz
go-tangerine-24349144b6c0642755569268bab56b9033743212.tar.bz2
go-tangerine-24349144b6c0642755569268bab56b9033743212.tar.lz
go-tangerine-24349144b6c0642755569268bab56b9033743212.tar.xz
go-tangerine-24349144b6c0642755569268bab56b9033743212.tar.zst
go-tangerine-24349144b6c0642755569268bab56b9033743212.zip
Merge branch 'master' into max-stream-peer-servers
Diffstat (limited to 'whisper/whisperv5/api.go')
-rw-r--r--whisper/whisperv5/api.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/whisper/whisperv5/api.go b/whisper/whisperv5/api.go
index 2ce464220..7d963df8d 100644
--- a/whisper/whisperv5/api.go
+++ b/whisper/whisperv5/api.go
@@ -28,7 +28,7 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
- "github.com/ethereum/go-ethereum/p2p/discover"
+ "github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/rpc"
)
@@ -96,12 +96,12 @@ func (api *PublicWhisperAPI) SetMinPoW(ctx context.Context, pow float64) (bool,
// MarkTrustedPeer marks a peer trusted. , which will allow it to send historic (expired) messages.
// Note: This function is not adding new nodes, the node needs to exists as a peer.
-func (api *PublicWhisperAPI) MarkTrustedPeer(ctx context.Context, enode string) (bool, error) {
- n, err := discover.ParseNode(enode)
+func (api *PublicWhisperAPI) MarkTrustedPeer(ctx context.Context, url string) (bool, error) {
+ n, err := enode.ParseV4(url)
if err != nil {
return false, err
}
- return true, api.w.AllowP2PMessagesFromPeer(n.ID[:])
+ return true, api.w.AllowP2PMessagesFromPeer(n.ID().Bytes())
}
// NewKeyPair generates a new public and private key pair for message decryption and encryption.
@@ -270,11 +270,11 @@ func (api *PublicWhisperAPI) Post(ctx context.Context, req NewMessage) (bool, er
// send to specific node (skip PoW check)
if len(req.TargetPeer) > 0 {
- n, err := discover.ParseNode(req.TargetPeer)
+ n, err := enode.ParseV4(req.TargetPeer)
if err != nil {
return false, fmt.Errorf("failed to parse target peer: %s", err)
}
- return true, api.w.SendP2PMessage(n.ID[:], env)
+ return true, api.w.SendP2PMessage(n.ID().Bytes(), env)
}
// ensure that the message PoW meets the node's minimum accepted PoW