mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
contrib: update generate-seeds.py to ignore torv2 addresses
This commit is contained in:
parent
8be56f0f8e
commit
5f7e086dac
1 changed files with 11 additions and 6 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Reference in a new issue