|
14 | 14 | ACCEPTABLE_STALE_HOURS, |
15 | 15 | AUCTION_START_GAS_CONSTANT, |
16 | 16 | AUCTION_START_GAS_MARGINAL, |
17 | | - DEFAULT_RECOGNIZED_TLDS, |
18 | 17 | EMPTY_SHA3_BYTES, |
19 | 18 | MIN_ETH_LABEL_LENGTH, |
20 | 19 | REVERSE_REGISTRAR_DOMAIN, |
21 | 20 | ) |
22 | 21 | from ens.exceptions import ( |
23 | 22 | InvalidLabel, |
24 | 23 | InvalidName, |
25 | | - InvalidTLD, |
26 | 24 | ) |
27 | 25 |
|
28 | 26 | default = object() |
@@ -109,32 +107,6 @@ def is_valid_name(name): |
109 | 107 | return False |
110 | 108 |
|
111 | 109 |
|
112 | | -def label_to_name(label, recognized_tlds): |
113 | | - label = normalize_name(label) |
114 | | - pieces = label.split('.') |
115 | | - if pieces[-1] not in recognized_tlds: |
116 | | - raise InvalidTLD( |
117 | | - f"The label: {label} has an unsupported TLD of {pieces[-1]}. " |
118 | | - f"ENS.py by default supports the following TLDs: {recognized_tlds}. " |
119 | | - "If you'd like to use an unsupported TLD, please set the environment variable: " |
120 | | - "'ENS_RECOGNIZED_TLDS' to a string of desired TLDs separated by a colon (:)." |
121 | | - ) |
122 | | - return '.'.join(pieces) |
123 | | - |
124 | | - |
125 | | -def dot_eth_name(label): |
126 | | - recognized_tlds = get_recognized_tlds() |
127 | | - return label_to_name(label, recognized_tlds) |
128 | | - |
129 | | - |
130 | | -def get_recognized_tlds(): |
131 | | - if 'ENS_RECOGNIZED_TLDS' in os.environ: |
132 | | - override_tlds = os.environ['ENS_RECOGNIZED_TLDS'].split(':') |
133 | | - return set(DEFAULT_RECOGNIZED_TLDS + override_tlds) |
134 | | - else: |
135 | | - return DEFAULT_RECOGNIZED_TLDS |
136 | | - |
137 | | - |
138 | 110 | def name_to_label(name, registrar): |
139 | 111 | name = normalize_name(name) |
140 | 112 | if '.' not in name: |
@@ -214,7 +186,7 @@ def dot_eth_namehash(name): |
214 | 186 | :rtype: bytes |
215 | 187 | :raises InvalidName: if ``name`` has invalid syntax |
216 | 188 | ''' |
217 | | - expanded_name = dot_eth_name(name) |
| 189 | + expanded_name = normalize_name(name) |
218 | 190 | return name_to_hash(expanded_name) |
219 | 191 |
|
220 | 192 |
|
|
0 commit comments