aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorbrunoerg <brunoely.gc@gmail.com>2022-12-14 13:04:06 -0300
committerbrunoerg <brunoely.gc@gmail.com>2022-12-19 07:20:14 -0300
commit1c07500dbb6b93510425c8bbdb320f2533efdb3d (patch)
treeea29652f4207d20318fcb2d4eb76b35e0ac0cb86 /contrib
parenta4baf3f177489f21b044468298825a70a1a15648 (diff)
downloadbitcoin-1c07500dbb6b93510425c8bbdb320f2533efdb3d.tar.xz
contrib: make DNS seeds file an argument in CLI
Diffstat (limited to 'contrib')
-rw-r--r--contrib/seeds/README.md2
-rwxr-xr-xcontrib/seeds/makeseeds.py4
2 files changed, 4 insertions, 2 deletions
diff --git a/contrib/seeds/README.md b/contrib/seeds/README.md
index b2ea7522ac..b0bbe96493 100644
--- a/contrib/seeds/README.md
+++ b/contrib/seeds/README.md
@@ -13,6 +13,6 @@ data. Run the following commands from the `/contrib/seeds` directory:
curl https://bitcoin.sipa.be/seeds.txt.gz | gzip -dc > seeds_main.txt
curl https://bitcoin.sipa.be/asmap-filled.dat > asmap-filled.dat
- python3 makeseeds.py -a asmap-filled.dat < seeds_main.txt > nodes_main.txt
+ python3 makeseeds.py -a asmap-filled.dat -s seeds_main.txt > nodes_main.txt
cat nodes_main_manual.txt >> nodes_main.txt
python3 generate-seeds.py . > ../../src/chainparamsseeds.h
diff --git a/contrib/seeds/makeseeds.py b/contrib/seeds/makeseeds.py
index eda58c370f..23d38ee48d 100755
--- a/contrib/seeds/makeseeds.py
+++ b/contrib/seeds/makeseeds.py
@@ -173,6 +173,7 @@ def ip_stats(ips: List[Dict]) -> str:
def parse_args():
argparser = argparse.ArgumentParser(description='Generate a list of bitcoin node seed ip addresses.')
argparser.add_argument("-a","--asmap", help='the location of the asmap asn database file (required)', required=True)
+ argparser.add_argument("-s","--seeds", help='the location of the DNS seeds file (required)', required=True)
return argparser.parse_args()
def main():
@@ -184,7 +185,8 @@ def main():
print('Done.', file=sys.stderr)
print('Loading and parsing DNS seeds…', end='', file=sys.stderr, flush=True)
- lines = sys.stdin.readlines()
+ with open(args.seeds, 'r', encoding='utf8') as f:
+ lines = f.readlines()
ips = [parseline(line) for line in lines]
print('Done.', file=sys.stderr)