aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-02-10 10:16:14 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2017-02-10 10:29:09 +0100
commit4dfac2c95084dd0bcf0d7d5dc2e9d60f027a7be4 (patch)
tree066630f819c0c0e9ac20eb45330efac24bb93008 /contrib
parent33f3b21407a38faaaee2d72d16e8eb340fe74657 (diff)
downloadbitcoin-4dfac2c95084dd0bcf0d7d5dc2e9d60f027a7be4.tar.xz
Update seeds tooling to Python 3
All the other tooling scripts require Python 3, it makes sense to do so here too. Also document the dependency on python3-dnspython.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/seeds/README.md11
-rwxr-xr-xcontrib/seeds/generate-seeds.py6
-rwxr-xr-xcontrib/seeds/makeseeds.py14
3 files changed, 18 insertions, 13 deletions
diff --git a/contrib/seeds/README.md b/contrib/seeds/README.md
index c595f83eb9..aa97dafdb5 100644
--- a/contrib/seeds/README.md
+++ b/contrib/seeds/README.md
@@ -1,4 +1,4 @@
-### Seeds ###
+# Seeds
Utility to generate the seeds.txt list that is compiled into the client
(see [src/chainparamsseeds.h](/src/chainparamsseeds.h) and other utilities in [contrib/seeds](/contrib/seeds)).
@@ -6,6 +6,11 @@ Utility to generate the seeds.txt list that is compiled into the client
The seeds compiled into the release are created from sipa's DNS seed data, like this:
curl -s http://bitcoin.sipa.be/seeds.txt > seeds_main.txt
- python makeseeds.py < seeds_main.txt > nodes_main.txt
- python generate-seeds.py . > ../../src/chainparamsseeds.h
+ python3 makeseeds.py < seeds_main.txt > nodes_main.txt
+ python3 generate-seeds.py . > ../../src/chainparamsseeds.h
+## Dependencies
+
+Ubuntu:
+
+ sudo apt-get install python3-dnspython
diff --git a/contrib/seeds/generate-seeds.py b/contrib/seeds/generate-seeds.py
index f43dc0b218..b0ac92ae03 100755
--- a/contrib/seeds/generate-seeds.py
+++ b/contrib/seeds/generate-seeds.py
@@ -1,5 +1,5 @@
-#!/usr/bin/env python
-# Copyright (c) 2014 Wladimir J. van der Laan
+#!/usr/bin/env python3
+# Copyright (c) 2014-2017 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
@@ -31,7 +31,7 @@ The output will be two data structures with the peers in binary format:
These should be pasted into `src/chainparamsseeds.h`.
'''
-from __future__ import print_function, division
+
from base64 import b32decode
from binascii import a2b_hex
import sys, os
diff --git a/contrib/seeds/makeseeds.py b/contrib/seeds/makeseeds.py
index 95498d20e2..33fbb5851e 100755
--- a/contrib/seeds/makeseeds.py
+++ b/contrib/seeds/makeseeds.py
@@ -1,5 +1,5 @@
-#!/usr/bin/env python
-# Copyright (c) 2013-2016 The Bitcoin Core developers
+#!/usr/bin/env python3
+# Copyright (c) 2013-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
@@ -14,13 +14,13 @@ MIN_BLOCKS = 337600
# These are hosts that have been observed to be behaving strangely (e.g.
# aggressively connecting to every node).
-SUSPICIOUS_HOSTS = set([
+SUSPICIOUS_HOSTS = {
"130.211.129.106", "178.63.107.226",
"83.81.130.26", "88.198.17.7", "148.251.238.178", "176.9.46.6",
"54.173.72.127", "54.174.10.182", "54.183.64.54", "54.194.231.211",
"54.66.214.167", "54.66.220.137", "54.67.33.14", "54.77.251.214",
"54.94.195.96", "54.94.200.247"
-])
+}
import re
import sys
@@ -104,7 +104,7 @@ def filtermultiport(ips):
hist = collections.defaultdict(list)
for ip in ips:
hist[ip['sortkey']].append(ip)
- return [value[0] for (key,value) in hist.items() if len(value)==1]
+ return [value[0] for (key,value) in list(hist.items()) if len(value)==1]
# Based on Greg Maxwell's seed_filter.py
def filterbyasn(ips, max_per_asn, max_total):
@@ -164,9 +164,9 @@ def main():
for ip in ips:
if ip['net'] == 'ipv6':
- print '[%s]:%i' % (ip['ip'], ip['port'])
+ print('[%s]:%i' % (ip['ip'], ip['port']))
else:
- print '%s:%i' % (ip['ip'], ip['port'])
+ print('%s:%i' % (ip['ip'], ip['port']))
if __name__ == '__main__':
main()