aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/whisper.go
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2015-03-14 18:39:35 +0800
committerMaran <maran.hidskes@gmail.com>2015-03-14 18:39:35 +0800
commit991993357c902eaab56726bef97e7494674aa5e5 (patch)
tree1277d00e29b3444290664cd07529a3f006cb7b6b /xeth/whisper.go
parentb927c29469864424a97c06ff2f31e2d882b01cd7 (diff)
downloadgo-tangerine-991993357c902eaab56726bef97e7494674aa5e5.tar
go-tangerine-991993357c902eaab56726bef97e7494674aa5e5.tar.gz
go-tangerine-991993357c902eaab56726bef97e7494674aa5e5.tar.bz2
go-tangerine-991993357c902eaab56726bef97e7494674aa5e5.tar.lz
go-tangerine-991993357c902eaab56726bef97e7494674aa5e5.tar.xz
go-tangerine-991993357c902eaab56726bef97e7494674aa5e5.tar.zst
go-tangerine-991993357c902eaab56726bef97e7494674aa5e5.zip
DRY up the use of fromHex and put it in ethutil
Diffstat (limited to 'xeth/whisper.go')
-rw-r--r--xeth/whisper.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/xeth/whisper.go b/xeth/whisper.go
index d9c7e1614..f5c26faae 100644
--- a/xeth/whisper.go
+++ b/xeth/whisper.go
@@ -5,6 +5,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/crypto"
+ "github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/whisper"
)
@@ -28,12 +29,12 @@ func (self *Whisper) Post(payload string, to, from string, topics []string, prio
ttl = 100
}
- pk := crypto.ToECDSAPub(fromHex(from))
+ pk := crypto.ToECDSAPub(ethutil.FromHex(from))
if key := self.Whisper.GetIdentity(pk); key != nil || len(from) == 0 {
- msg := whisper.NewMessage(fromHex(payload))
+ msg := whisper.NewMessage(ethutil.FromHex(payload))
envelope, err := msg.Seal(time.Duration(priority*100000), whisper.Opts{
Ttl: time.Duration(ttl) * time.Second,
- To: crypto.ToECDSAPub(fromHex(to)),
+ To: crypto.ToECDSAPub(ethutil.FromHex(to)),
From: key,
Topics: whisper.TopicsFromString(topics...),
})
@@ -59,13 +60,13 @@ func (self *Whisper) NewIdentity() string {
}
func (self *Whisper) HasIdentity(key string) bool {
- return self.Whisper.HasIdentity(crypto.ToECDSAPub(fromHex(key)))
+ return self.Whisper.HasIdentity(crypto.ToECDSAPub(ethutil.FromHex(key)))
}
func (self *Whisper) Watch(opts *Options) int {
filter := whisper.Filter{
- To: crypto.ToECDSAPub(fromHex(opts.To)),
- From: crypto.ToECDSAPub(fromHex(opts.From)),
+ To: crypto.ToECDSAPub(ethutil.FromHex(opts.To)),
+ From: crypto.ToECDSAPub(ethutil.FromHex(opts.From)),
Topics: whisper.TopicsFromString(opts.Topics...),
}