Fix ens name hash exception for bad names

Fixes #11022

Signed-off-by: Gheorghe Pinzaru <feross95@gmail.com>
This commit is contained in:
Gheorghe Pinzaru 2020-08-05 17:28:15 +03:00
parent 95997530c6
commit 72726e2b0b
No known key found for this signature in database
GPG Key ID: C9A094959935A952

View File

@ -28,8 +28,10 @@
(let [[label remainder] (-> s
string/lower-case
(string/split #"\." 2))]
(ethereum/sha3 (str (namehash remainder)
(subs (ethereum/sha3 label) 2)))))))
(if-not (seq label)
default-namehash
(ethereum/sha3 (str (namehash remainder)
(subs (ethereum/sha3 label) 2))))))))
;; Registry contract