aboutsummaryrefslogtreecommitdiff
path: root/contrib/seeds/generate-seeds.py
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/seeds/generate-seeds.py')
-rwxr-xr-xcontrib/seeds/generate-seeds.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/contrib/seeds/generate-seeds.py b/contrib/seeds/generate-seeds.py
index 9560b586ec..dbecba7d1d 100755
--- a/contrib/seeds/generate-seeds.py
+++ b/contrib/seeds/generate-seeds.py
@@ -37,7 +37,7 @@ import re
class BIP155Network(Enum):
IPV4 = 1
IPV6 = 2
- TORV2 = 3
+ TORV2 = 3 # no longer supported
TORV3 = 4
I2P = 5
CJDNS = 6
@@ -46,11 +46,11 @@ def name_to_bip155(addr):
'''Convert address string to BIP155 (networkID, addr) tuple.'''
if addr.endswith('.onion'):
vchAddr = b32decode(addr[0:-6], True)
- if len(vchAddr) == 10:
- return (BIP155Network.TORV2, vchAddr)
- elif len(vchAddr) == 35:
- assert(vchAddr[34] == 3)
+ if len(vchAddr) == 35:
+ assert vchAddr[34] == 3
return (BIP155Network.TORV3, vchAddr[:32])
+ elif len(vchAddr) == 10:
+ return (BIP155Network.TORV2, vchAddr)
else:
raise ValueError('Invalid onion %s' % vchAddr)
elif addr.endswith('.b32.i2p'):
@@ -100,7 +100,10 @@ def parse_spec(s):
host = name_to_bip155(host)
- return host + (port, )
+ if host[0] == BIP155Network.TORV2:
+ return None # TORV2 is no longer supported, so we ignore it
+ else:
+ return host + (port, )
def ser_compact_size(l):
r = b""
@@ -136,6 +139,8 @@ def process_nodes(g, f, structname):
continue
spec = parse_spec(line)
+ if spec is None: # ignore this entry (e.g. no longer supported addresses like TORV2)
+ continue
blob = bip155_serialize(spec)
hoststr = ','.join(('0x%02x' % b) for b in blob)
g.write(f' {hoststr},\n')