From adab2e16bdf24c2eaf498722187fb36c04a5376b Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 12 Dec 2016 12:25:59 +0100 Subject: rpc: remove HexBytes, replace all uses with hexutil.Bytes --- whisper/shhapi/api.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'whisper/shhapi') diff --git a/whisper/shhapi/api.go b/whisper/shhapi/api.go index f2597e133..8a0bd9214 100644 --- a/whisper/shhapi/api.go +++ b/whisper/shhapi/api.go @@ -23,6 +23,7 @@ import ( mathrand "math/rand" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" @@ -81,7 +82,7 @@ func (api *PublicWhisperAPI) Version() (*rpc.HexNumber, error) { // MarkPeerTrusted marks specific peer trusted, which will allow it // to send historic (expired) messages. -func (api *PublicWhisperAPI) MarkPeerTrusted(peerID rpc.HexBytes) error { +func (api *PublicWhisperAPI) MarkPeerTrusted(peerID hexutil.Bytes) error { if api.whisper == nil { return whisperOffLineErr } @@ -92,7 +93,7 @@ func (api *PublicWhisperAPI) MarkPeerTrusted(peerID rpc.HexBytes) error { // data contains parameters (time frame, payment details, etc.), required // by the remote email-like server. Whisper is not aware about the data format, // it will just forward the raw data to the server. -func (api *PublicWhisperAPI) RequestHistoricMessages(peerID rpc.HexBytes, data rpc.HexBytes) error { +func (api *PublicWhisperAPI) RequestHistoricMessages(peerID hexutil.Bytes, data hexutil.Bytes) error { if api.whisper == nil { return whisperOffLineErr } @@ -388,12 +389,12 @@ type PostArgs struct { To string `json:"to"` KeyName string `json:"keyname"` Topic whisperv5.TopicType `json:"topic"` - Padding rpc.HexBytes `json:"padding"` - Payload rpc.HexBytes `json:"payload"` + Padding hexutil.Bytes `json:"padding"` + Payload hexutil.Bytes `json:"payload"` WorkTime uint32 `json:"worktime"` PoW float64 `json:"pow"` FilterID uint32 `json:"filterID"` - PeerID rpc.HexBytes `json:"peerID"` + PeerID hexutil.Bytes `json:"peerID"` } type WhisperFilterArgs struct { -- cgit v1.2.3 From cf71f5cd604f4d5c94d9e9b12b121a614d662dc7 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Sat, 17 Dec 2016 15:39:55 +0100 Subject: rpc: remove HexNumber, replace all uses with hexutil types This change couldn't be automated because HexNumber was used for numbers of all sizes. --- whisper/shhapi/api.go | 6 +++--- whisper/shhapi/api_test.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'whisper/shhapi') diff --git a/whisper/shhapi/api.go b/whisper/shhapi/api.go index 8a0bd9214..24d54b653 100644 --- a/whisper/shhapi/api.go +++ b/whisper/shhapi/api.go @@ -73,11 +73,11 @@ func (api *PublicWhisperAPI) Stop() error { } // Version returns the Whisper version this node offers. -func (api *PublicWhisperAPI) Version() (*rpc.HexNumber, error) { +func (api *PublicWhisperAPI) Version() (hexutil.Uint, error) { if api.whisper == nil { - return rpc.NewHexNumber(0), whisperOffLineErr + return 0, whisperOffLineErr } - return rpc.NewHexNumber(api.whisper.Version()), nil + return hexutil.Uint(api.whisper.Version()), nil } // MarkPeerTrusted marks specific peer trusted, which will allow it diff --git a/whisper/shhapi/api_test.go b/whisper/shhapi/api_test.go index a10e2e476..d2890a9a3 100644 --- a/whisper/shhapi/api_test.go +++ b/whisper/shhapi/api_test.go @@ -39,8 +39,8 @@ func TestBasic(t *testing.T) { t.Fatalf("failed generateFilter: %s.", err) } - if ver.Uint64() != whisperv5.ProtocolVersion { - t.Fatalf("wrong version: %d.", ver.Uint64()) + if uint64(ver) != whisperv5.ProtocolVersion { + t.Fatalf("wrong version: %d.", ver) } mail := api.GetFilterChanges(1) -- cgit v1.2.3