From 3475a4b22586fb443aa35e380b2d3eb143d998b4 Mon Sep 17 00:00:00 2001 From: kane Date: Mon, 30 Jul 2018 02:16:23 -0400 Subject: [PATCH] catch error if rlp.Encode failed --- core/types/block.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/types/block.go b/core/types/block.go index ae1b4299d3..ddc7e4c097 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -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 }