Skip to content

Commit d978c41

Browse files
committed
Merge #9736: Pre-0.14.0 hardcoded seeds update
a60677e Pre-0.14.0 hardcoded seeds update (Wladimir J. van der Laan) bfa9393 contrib/seeds: Update PATTERN_AGENT (Wladimir J. van der Laan) 4dfac2c Update seeds tooling to Python 3 (Wladimir J. van der Laan)
2 parents a06ede9 + a60677e commit d978c41

File tree

5 files changed

+2084
-1614
lines changed

5 files changed

+2084
-1614
lines changed

contrib/seeds/README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1-
### Seeds ###
1+
# Seeds
22

33
Utility to generate the seeds.txt list that is compiled into the client
44
(see [src/chainparamsseeds.h](/src/chainparamsseeds.h) and other utilities in [contrib/seeds](/contrib/seeds)).
55

6+
Be sure to update `PATTERN_AGENT` in `makeseeds.py` to include the current version,
7+
and remove old versions as necessary.
8+
69
The seeds compiled into the release are created from sipa's DNS seed data, like this:
710

811
curl -s http://bitcoin.sipa.be/seeds.txt > seeds_main.txt
9-
python makeseeds.py < seeds_main.txt > nodes_main.txt
10-
python generate-seeds.py . > ../../src/chainparamsseeds.h
12+
python3 makeseeds.py < seeds_main.txt > nodes_main.txt
13+
python3 generate-seeds.py . > ../../src/chainparamsseeds.h
14+
15+
## Dependencies
16+
17+
Ubuntu:
1118

19+
sudo apt-get install python3-dnspython

contrib/seeds/generate-seeds.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#!/usr/bin/env python
2-
# Copyright (c) 2014 Wladimir J. van der Laan
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2014-2017 Wladimir J. van der Laan
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
'''
@@ -31,7 +31,7 @@
3131
3232
These should be pasted into `src/chainparamsseeds.h`.
3333
'''
34-
from __future__ import print_function, division
34+
3535
from base64 import b32decode
3636
from binascii import a2b_hex
3737
import sys, os

contrib/seeds/makeseeds.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#!/usr/bin/env python
2-
# Copyright (c) 2013-2016 The Bitcoin Core developers
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2013-2017 The Bitcoin Core developers
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
#
@@ -14,13 +14,13 @@
1414

1515
# These are hosts that have been observed to be behaving strangely (e.g.
1616
# aggressively connecting to every node).
17-
SUSPICIOUS_HOSTS = set([
17+
SUSPICIOUS_HOSTS = {
1818
"130.211.129.106", "178.63.107.226",
1919
"83.81.130.26", "88.198.17.7", "148.251.238.178", "176.9.46.6",
2020
"54.173.72.127", "54.174.10.182", "54.183.64.54", "54.194.231.211",
2121
"54.66.214.167", "54.66.220.137", "54.67.33.14", "54.77.251.214",
2222
"54.94.195.96", "54.94.200.247"
23-
])
23+
}
2424

2525
import re
2626
import sys
@@ -30,7 +30,7 @@
3030
PATTERN_IPV4 = re.compile(r"^((\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})):(\d+)$")
3131
PATTERN_IPV6 = re.compile(r"^\[([0-9a-z:]+)\]:(\d+)$")
3232
PATTERN_ONION = re.compile(r"^([abcdefghijklmnopqrstuvwxyz234567]{16}\.onion):(\d+)$")
33-
PATTERN_AGENT = re.compile(r"^(\/Satoshi:0\.8\.6\/|\/Satoshi:0\.9\.(2|3|4|5)\/|\/Satoshi:0\.10\.\d{1,2}\/|\/Satoshi:0\.11\.\d{1,2}\/)$")
33+
PATTERN_AGENT = re.compile(r"^(/Satoshi:0.12.(0|1|99)/|/Satoshi:0.13.(0|1|2|99)/)$")
3434

3535
def parseline(line):
3636
sline = line.split()
@@ -104,7 +104,7 @@ def filtermultiport(ips):
104104
hist = collections.defaultdict(list)
105105
for ip in ips:
106106
hist[ip['sortkey']].append(ip)
107-
return [value[0] for (key,value) in hist.items() if len(value)==1]
107+
return [value[0] for (key,value) in list(hist.items()) if len(value)==1]
108108

109109
# Based on Greg Maxwell's seed_filter.py
110110
def filterbyasn(ips, max_per_asn, max_total):
@@ -164,9 +164,9 @@ def main():
164164

165165
for ip in ips:
166166
if ip['net'] == 'ipv6':
167-
print '[%s]:%i' % (ip['ip'], ip['port'])
167+
print('[%s]:%i' % (ip['ip'], ip['port']))
168168
else:
169-
print '%s:%i' % (ip['ip'], ip['port'])
169+
print('%s:%i' % (ip['ip'], ip['port']))
170170

171171
if __name__ == '__main__':
172172
main()

0 commit comments

Comments
 (0)