mirror of https://github.com/status-im/op-geth.git
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: ty <ty@oncoder.com>
This commit is contained in:
parent
85aafcfb2b
commit
88132afc3f
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue