From 8339dc3b1a389ced232573c46e106de2fce9f112 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Thu, 27 Apr 2017 19:18:53 -0400 Subject: [PATCH] types: Result and Validator use data.Bytes --- types/result.go | 4 +++- types/validators.go | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/types/result.go b/types/result.go index af89058e..d7e231d8 100644 --- a/types/result.go +++ b/types/result.go @@ -2,12 +2,14 @@ package types import ( "fmt" + + "github.com/tendermint/go-wire/data" ) // CONTRACT: a zero Result is OK. type Result struct { Code CodeType - Data []byte + Data data.Bytes Log string // Can be non-deterministic } diff --git a/types/validators.go b/types/validators.go index 185355d1..a83c6d40 100644 --- a/types/validators.go +++ b/types/validators.go @@ -2,8 +2,9 @@ package types import ( "bytes" + "encoding/json" - "github.com/tendermint/go-wire" + "github.com/tendermint/go-wire/data" ) // validators implements sort @@ -28,8 +29,8 @@ func (v Validators) Swap(i, j int) { //------------------------------------- type validatorPretty struct { - PubKey []byte `json:"pub_key"` - Power uint64 `json:"power"` + PubKey data.Bytes `json:"pub_key"` + Power uint64 `json:"power"` } func ValidatorsString(vs Validators) string { @@ -37,5 +38,6 @@ func ValidatorsString(vs Validators) string { for i, v := range vs { s[i] = validatorPretty{v.PubKey, v.Power} } - return string(wire.JSONBytes(s)) + b, _ := json.Marshal(s) + return string(b) }