1
0
Fork 0
mirror of https://github.com/NeoCloud/NeoNetwork synced 2024-12-26 00:29:23 +08:00
This commit is contained in:
JerryXiao 2020-05-22 19:48:54 +08:00
parent 555c6ce53e
commit 37f3cb5ebe
Signed by: Jerry
GPG key ID: 9D9CE43650FF2BAA

View file

@ -113,14 +113,16 @@ def neonet_get_asns():
if not f.is_file(): if not f.is_file():
continue continue
fc = shell2dict(f.read_text()) fc = shell2dict(f.read_text())
present_keys = ('name', 'owner', 'desc', 'external') present_keys = ('name', 'owner', 'desc', 'source')
required_keys = ('name', 'owner') required_keys = ('name', 'owner', 'source')
asn = str2asn(f.name, 1) asn = str2asn(f.name, 1)
asns[asn] = {k: fc.get(k) for k in present_keys} asns[asn] = {k: fc.get(k) for k in present_keys}
assert fc.get('owner') in PEOPLE assert fc.get('owner') in PEOPLE
for k in required_keys: for k in required_keys:
assert asns[asn].get(k) # required fields missing assert asns[asn].get(k) # required fields missing
assert AS_IS_NEONET(asn) or asns[asn].get('external') as_src = asns[asn].get('source')
assert as_src in ('NeoNetwork', 'DN42', 'INET')
assert AS_IS_NEONET(asn) or as_src != 'NeoNetwork'
except Exception: except Exception:
print("[!] Error while processing file", f) print("[!] Error while processing file", f)
raise raise