aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/whisper.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-03-14 18:46:32 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-03-14 18:46:32 +0800
commit51df765e3892285bda6d40340dc6febfcd2e7ce6 (patch)
treeeb55d41ec2f62babef19af22e7fadf5280935d47 /xeth/whisper.go
parentb927c29469864424a97c06ff2f31e2d882b01cd7 (diff)
parent9754e7aca79a3d24ac17589f548072a4dca68fbb (diff)
downloadgo-tangerine-51df765e3892285bda6d40340dc6febfcd2e7ce6.tar
go-tangerine-51df765e3892285bda6d40340dc6febfcd2e7ce6.tar.gz
go-tangerine-51df765e3892285bda6d40340dc6febfcd2e7ce6.tar.bz2
go-tangerine-51df765e3892285bda6d40340dc6febfcd2e7ce6.tar.lz
go-tangerine-51df765e3892285bda6d40340dc6febfcd2e7ce6.tar.xz
go-tangerine-51df765e3892285bda6d40340dc6febfcd2e7ce6.tar.zst
go-tangerine-51df765e3892285bda6d40340dc6febfcd2e7ce6.zip
Merge pull request #481 from maran/feature/fromHexDry
DRY-up the use of fromHex in the project
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...),
}