Skip to content

Commit 9f27157

Browse files
committed
contrib: make-seeds updates for 23.x
Documentation: - Use https URL for bitcoin.sipa.be (http sends a redirect, fooling curl). - Add explicit step to add manual seeds. Code: - Change PATTERN_ONION to v3 (effectively means that the no onion hosts are delivered). - Add versions to PATTERN_AGENT filter. - Print specific message on resolve exception.
1 parent c44e734 commit 9f27157

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

contrib/seeds/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ to addrman with).
1010

1111
The seeds compiled into the release are created from sipa's DNS seed data, like this:
1212

13-
curl -s http://bitcoin.sipa.be/seeds.txt.gz | gzip -dc > seeds_main.txt
13+
curl https://bitcoin.sipa.be/seeds.txt.gz | gzip -dc > seeds_main.txt
1414
python3 makeseeds.py < seeds_main.txt > nodes_main.txt
15+
cat nodes_main_manual.txt >> nodes_main.txt
1516
python3 generate-seeds.py . > ../../src/chainparamsseeds.h
1617

1718
## Dependencies

contrib/seeds/makeseeds.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,19 @@
2525

2626
PATTERN_IPV4 = re.compile(r"^((\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})):(\d+)$")
2727
PATTERN_IPV6 = re.compile(r"^\[([0-9a-z:]+)\]:(\d+)$")
28-
PATTERN_ONION = re.compile(r"^([abcdefghijklmnopqrstuvwxyz234567]{16}\.onion):(\d+)$")
28+
PATTERN_ONION = re.compile(r"^([a-z2-7]{56}\.onion):(\d+)$")
2929
PATTERN_AGENT = re.compile(
3030
r"^/Satoshi:("
3131
r"0.14.(0|1|2|3|99)|"
3232
r"0.15.(0|1|2|99)|"
3333
r"0.16.(0|1|2|3|99)|"
3434
r"0.17.(0|0.1|1|2|99)|"
3535
r"0.18.(0|1|99)|"
36-
r"0.19.(0|1|99)|"
37-
r"0.20.(0|1|99)|"
38-
r"0.21.99"
36+
r"0.19.(0|1|2|99)|"
37+
r"0.20.(0|1|2|99)|"
38+
r"0.21.(0|1|2|99)|"
39+
r"22.(0|99)|"
40+
r"23.99"
3941
r")")
4042

4143
def parseline(line):
@@ -140,8 +142,8 @@ def lookup_asn(net, ip):
140142
reversed(ipaddr.split('.'))) + prefix + '.asn.cymru.com',
141143
'TXT').response.answer][0].split('\"')[1].split(' ')[0])
142144
return asn
143-
except Exception:
144-
sys.stderr.write('ERR: Could not resolve ASN for "' + ip + '"\n')
145+
except Exception as e:
146+
sys.stderr.write(f'ERR: Could not resolve ASN for "{ip}": {e}\n')
145147
return None
146148

147149
# Based on Greg Maxwell's seed_filter.py

0 commit comments

Comments
 (0)