1
0
Fork 0
mirror of https://github.com/NeoCloud/NeoNetwork synced 2024-12-26 14:19:25 +08:00

update roa.py for external asn check

This commit is contained in:
JerryXiao 2020-05-22 18:57:13 +08:00
parent a9b5ae328c
commit 555c6ce53e
Signed by: Jerry
GPG key ID: 9D9CE43650FF2BAA

View file

@ -113,12 +113,13 @@ 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') present_keys = ('name', 'owner', 'desc', 'external')
required_keys = ('name', 'owner')
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 v in asns[asn].values(): for k in required_keys:
assert v is not None assert asns[asn].get(k) # required fields missing
assert AS_IS_NEONET(asn) or asns[asn].get('external') assert AS_IS_NEONET(asn) or asns[asn].get('external')
except Exception: except Exception:
print("[!] Error while processing file", f) print("[!] Error while processing file", f)