replace data.Bytes with cmn.HexBytes

This commit is contained in:
Ethan Buchman
2018-02-03 03:42:59 -05:00
parent 426379dc47
commit 7a5060dc52
22 changed files with 87 additions and 100 deletions

View File

@ -17,7 +17,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tendermint/go-wire/data"
client "github.com/tendermint/tendermint/rpc/lib/client"
server "github.com/tendermint/tendermint/rpc/lib/server"
types "github.com/tendermint/tendermint/rpc/lib/types"
@ -47,7 +46,7 @@ type ResultEchoBytes struct {
}
type ResultEchoDataBytes struct {
Value data.Bytes `json:"value"`
Value cmn.HexBytes `json:"value"`
}
// Define some routes
@ -75,7 +74,7 @@ func EchoBytesResult(v []byte) (*ResultEchoBytes, error) {
return &ResultEchoBytes{v}, nil
}
func EchoDataBytesResult(v data.Bytes) (*ResultEchoDataBytes, error) {
func EchoDataBytesResult(v cmn.HexBytes) (*ResultEchoDataBytes, error) {
return &ResultEchoDataBytes{v}, nil
}
@ -174,7 +173,7 @@ func echoBytesViaHTTP(cl client.HTTPClient, bytes []byte) ([]byte, error) {
return result.Value, nil
}
func echoDataBytesViaHTTP(cl client.HTTPClient, bytes data.Bytes) (data.Bytes, error) {
func echoDataBytesViaHTTP(cl client.HTTPClient, bytes cmn.HexBytes) (cmn.HexBytes, error) {
params := map[string]interface{}{
"arg": bytes,
}
@ -196,7 +195,7 @@ func testWithHTTPClient(t *testing.T, cl client.HTTPClient) {
require.Nil(t, err)
assert.Equal(t, got2, val2)
val3 := data.Bytes(randBytes(t))
val3 := cmn.HexBytes(randBytes(t))
got3, err := echoDataBytesViaHTTP(cl, val3)
require.Nil(t, err)
assert.Equal(t, got3, val3)