From 72e3214d541c3f5bf6b73485d2fb3ff247b3bc8c Mon Sep 17 00:00:00 2001 From: ty Date: Wed, 28 Sep 2022 18:02:12 +0900 Subject: [PATCH] In some cases, the value of the input string s may come in odd length and in this case, an error occurred in the hex.DecodeString function, causing the problem of not being able to proceed next in many case, in the case of me, the problem of not being able to read the value of getStorageAt occurred --- internal/ethapi/api.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 2e410605222..64b389612ab 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -714,6 +714,9 @@ func decodeHash(s string) (common.Hash, error) { if strings.HasPrefix(s, "0x") || strings.HasPrefix(s, "0X") { s = s[2:] } + if (len(s) & 1) > 0 { + s = "0" + s + } b, err := hex.DecodeString(s) if err != nil { return common.Hash{}, fmt.Errorf("hex string invalid")