mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-14 13:51:21 +00:00
Support nil pointers for Binary.
If the thing does not already have a typebyte declared, a fake one will be given (0x01). A TypeByte of 0x00 is reserved for nil things. No nil-dogs.
This commit is contained in:
@ -10,7 +10,7 @@ func BinaryBytes(o interface{}) []byte {
|
||||
w, n, err := new(bytes.Buffer), new(int64), new(error)
|
||||
WriteBinary(o, w, n, err)
|
||||
if *err != nil {
|
||||
panic(err)
|
||||
panic(*err)
|
||||
}
|
||||
return w.Bytes()
|
||||
}
|
||||
@ -19,7 +19,7 @@ func JSONBytes(o interface{}) []byte {
|
||||
w, n, err := new(bytes.Buffer), new(int64), new(error)
|
||||
WriteJSON(o, w, n, err)
|
||||
if *err != nil {
|
||||
panic(err)
|
||||
panic(*err)
|
||||
}
|
||||
return w.Bytes()
|
||||
}
|
||||
@ -42,7 +42,7 @@ func BinarySha256(o interface{}) []byte {
|
||||
hasher, n, err := sha256.New(), new(int64), new(error)
|
||||
WriteBinary(o, hasher, n, err)
|
||||
if *err != nil {
|
||||
panic(err)
|
||||
panic(*err)
|
||||
}
|
||||
return hasher.Sum(nil)
|
||||
}
|
||||
@ -51,7 +51,7 @@ func BinaryRipemd160(o interface{}) []byte {
|
||||
hasher, n, err := ripemd160.New(), new(int64), new(error)
|
||||
WriteBinary(o, hasher, n, err)
|
||||
if *err != nil {
|
||||
panic(err)
|
||||
panic(*err)
|
||||
}
|
||||
return hasher.Sum(nil)
|
||||
}
|
||||
|
Reference in New Issue
Block a user