DRY up the use of toHex in the project and move it to common
This commit is contained in:
@ -4,8 +4,8 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/logger"
|
||||
"github.com/ethereum/go-ethereum/whisper"
|
||||
)
|
||||
@ -56,7 +56,7 @@ func (self *Whisper) Post(payload string, to, from string, topics []string, prio
|
||||
func (self *Whisper) NewIdentity() string {
|
||||
key := self.Whisper.NewIdentity()
|
||||
|
||||
return toHex(crypto.FromECDSAPub(&key.PublicKey))
|
||||
return common.ToHex(crypto.FromECDSAPub(&key.PublicKey))
|
||||
}
|
||||
|
||||
func (self *Whisper) HasIdentity(key string) bool {
|
||||
@ -108,9 +108,9 @@ type WhisperMessage struct {
|
||||
func NewWhisperMessage(msg *whisper.Message) WhisperMessage {
|
||||
return WhisperMessage{
|
||||
ref: msg,
|
||||
Payload: toHex(msg.Payload),
|
||||
From: toHex(crypto.FromECDSAPub(msg.Recover())),
|
||||
To: toHex(crypto.FromECDSAPub(msg.To)),
|
||||
Payload: common.ToHex(msg.Payload),
|
||||
From: common.ToHex(crypto.FromECDSAPub(msg.Recover())),
|
||||
To: common.ToHex(crypto.FromECDSAPub(msg.To)),
|
||||
Sent: msg.Sent,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user