catch error if rlp.Encode failed

This commit is contained in:
kane 2018-07-30 02:16:23 -04:00
parent 93c0f1715d
commit 3475a4b225

View file

@ -129,7 +129,10 @@ func (h *Header) Size() common.StorageSize {
func rlpHash(x interface{}) (h common.Hash) {
hw := sha3.NewKeccak256()
rlp.Encode(hw, x)
err := rlp.Encode(hw, x)
if err != nil {
panic("encode error: " + err.Error())
}
hw.Sum(h[:0])
return h
}