mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
catch error if rlp.Encode failed
This commit is contained in:
parent
93c0f1715d
commit
3475a4b225
1 changed files with 4 additions and 1 deletions
|
|
@ -129,7 +129,10 @@ func (h *Header) Size() common.StorageSize {
|
||||||
|
|
||||||
func rlpHash(x interface{}) (h common.Hash) {
|
func rlpHash(x interface{}) (h common.Hash) {
|
||||||
hw := sha3.NewKeccak256()
|
hw := sha3.NewKeccak256()
|
||||||
rlp.Encode(hw, x)
|
err := rlp.Encode(hw, x)
|
||||||
|
if err != nil {
|
||||||
|
panic("encode error: " + err.Error())
|
||||||
|
}
|
||||||
hw.Sum(h[:0])
|
hw.Sum(h[:0])
|
||||||
return h
|
return h
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue