Unverified Commit 88132afc authored by TY's avatar TY Committed by GitHub

internal/ethapi: handle odd length hex in decodeHash (#25883)

This change adds zero-padding (prefix) of odd nibbles in the decodeHash function. 
Co-authored-by: 's avatarty <ty@oncoder.com>
parent 85aafcfb
......@@ -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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment