mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-23 17:51:39 +00:00
types: update for new go-wire. WriteSignBytes -> SignBytes
This commit is contained in:
@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -96,7 +95,11 @@ func (b *Block) Hash() cmn.HexBytes {
|
||||
// MakePartSet returns a PartSet containing parts of a serialized block.
|
||||
// This is the form in which the block is gossipped to peers.
|
||||
func (b *Block) MakePartSet(partSize int) *PartSet {
|
||||
return NewPartSetFromData(wire.BinaryBytes(b), partSize)
|
||||
bz, err := wire.MarshalBinary(b)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return NewPartSetFromData(bz, partSize)
|
||||
}
|
||||
|
||||
// HashesTo is a convenience function that checks if a block hashes to the given argument.
|
||||
@ -493,17 +496,11 @@ func (blockID BlockID) Equals(other BlockID) bool {
|
||||
|
||||
// Key returns a machine-readable string representation of the BlockID
|
||||
func (blockID BlockID) Key() string {
|
||||
return string(blockID.Hash) + string(wire.BinaryBytes(blockID.PartsHeader))
|
||||
}
|
||||
|
||||
// WriteSignBytes writes the canonical bytes of the BlockID to the given writer for digital signing
|
||||
func (blockID BlockID) WriteSignBytes(w io.Writer, n *int, err *error) {
|
||||
if blockID.IsZero() {
|
||||
wire.WriteTo([]byte("null"), w, n, err)
|
||||
} else {
|
||||
wire.WriteJSON(CanonicalBlockID(blockID), w, n, err)
|
||||
bz, err := wire.MarshalBinary(blockID.PartsHeader)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return string(blockID.Hash) + string(bz)
|
||||
}
|
||||
|
||||
// String returns a human readable string representation of the BlockID
|
||||
@ -527,6 +524,11 @@ func (h hasher) Hash() []byte {
|
||||
|
||||
}
|
||||
|
||||
func tmHash(item interface{}) []byte {
|
||||
h := hasher{item}
|
||||
return h.Hash()
|
||||
}
|
||||
|
||||
func wireHasher(item interface{}) merkle.Hasher {
|
||||
return hasher{item}
|
||||
}
|
||||
|
Reference in New Issue
Block a user