diff --git a/common/hexutil/hexutil.go b/common/hexutil/hexutil.go index d3201850a8..924f7d2513 100644 --- a/common/hexutil/hexutil.go +++ b/common/hexutil/hexutil.go @@ -64,6 +64,10 @@ func Decode(input string) ([]byte, error) { if !has0xPrefix(input) { return nil, ErrMissingPrefix } + // better compatible with odd size string + if len(input)%2 != 0 { + input = "0x0" + input[2:] + } b, err := hex.DecodeString(input[2:]) if err != nil { err = mapError(err)