Fix blockchain tests

This commit is contained in:
Jae Kwon
2018-04-05 05:17:43 -07:00
parent 196f8410ba
commit 1b9323f105
7 changed files with 49 additions and 22 deletions

View File

@ -94,7 +94,7 @@ 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 {
bz, err := cdc.MarshalBinary(b)
bz, err := cdc.MarshalBinaryBare(b)
if err != nil {
panic(err)
}
@ -498,7 +498,7 @@ func (blockID BlockID) Equals(other BlockID) bool {
// Key returns a machine-readable string representation of the BlockID
func (blockID BlockID) Key() string {
bz, err := cdc.MarshalBinary(blockID.PartsHeader)
bz, err := cdc.MarshalBinaryBare(blockID.PartsHeader)
if err != nil {
panic(err)
}
@ -518,7 +518,7 @@ type hasher struct {
func (h hasher) Hash() []byte {
hasher := ripemd160.New()
if h.item != nil && !cmn.IsTypedNil(h.item) {
if h.item != nil && !cmn.IsTypedNil(h.item) && !cmn.IsEmpty(h.item) {
bz, err := cdc.MarshalBinaryBare(h.item)
if err != nil {
panic(err)