Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit d24810e

Browse files
committed
Do not strip 0x in the middle of the string
This is causing checksum validation issues for addresses where 0x appears in the middle of the address not just at the beginning.
1 parent 876eab8 commit d24810e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

util/utils.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ const EmojiPattern = "[\\x{2712}\\x{2714}\\x{2716}\\x{271d}\\x{2721}\\x{2728}\\x
6565

6666
// NormalizeAddress is used to strip the 0x prefix
6767
func NormalizeAddress(addr string) string {
68-
return strings.Replace(addr, "0x", "", 1)
68+
if addr[0:2] == "0x" {
69+
return strings.Replace(addr, "0x", "", 1)
70+
}
71+
return addr
6972
}
7073

7174
// AreAddressesEqual - check if addresses are equal after normalizing them

0 commit comments

Comments
 (0)