Browse Source

types: Result and Validator use data.Bytes

pull/1780/head
Ethan Buchman 8 years ago
parent
commit
8339dc3b1a
2 changed files with 9 additions and 5 deletions
  1. +3
    -1
      types/result.go
  2. +6
    -4
      types/validators.go

+ 3
- 1
types/result.go View File

@ -2,12 +2,14 @@ package types
import ( import (
"fmt" "fmt"
"github.com/tendermint/go-wire/data"
) )
// CONTRACT: a zero Result is OK. // CONTRACT: a zero Result is OK.
type Result struct { type Result struct {
Code CodeType Code CodeType
Data []byte
Data data.Bytes
Log string // Can be non-deterministic Log string // Can be non-deterministic
} }


+ 6
- 4
types/validators.go View File

@ -2,8 +2,9 @@ package types
import ( import (
"bytes" "bytes"
"encoding/json"
"github.com/tendermint/go-wire"
"github.com/tendermint/go-wire/data"
) )
// validators implements sort // validators implements sort
@ -28,8 +29,8 @@ func (v Validators) Swap(i, j int) {
//------------------------------------- //-------------------------------------
type validatorPretty struct { 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 { func ValidatorsString(vs Validators) string {
@ -37,5 +38,6 @@ func ValidatorsString(vs Validators) string {
for i, v := range vs { for i, v := range vs {
s[i] = validatorPretty{v.PubKey, v.Power} s[i] = validatorPretty{v.PubKey, v.Power}
} }
return string(wire.JSONBytes(s))
b, _ := json.Marshal(s)
return string(b)
} }

Loading…
Cancel
Save