Skip to content

Commit 5a80086

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#26701: contrib: make DNS seeds file an argument in CLI (makeseeds)
1c07500 contrib: make DNS seeds file an argument in CLI (brunoerg) Pull request description: Instead of using `makeseeds.py` this way: ```sh python3 makeseeds.py -a asmap-filled.dat < seeds_main.txt > nodes_main.txt ``` We could use the DNS seeds file as an argument since it is a required one. It improves the way the script handles it when that file is missing as well as makes this script more friendly. E.g: ```sh python3 makeseeds.py -a asmap-filled.dat -s seeds_main.txt > nodes_main.txt ``` ACKs for top commit: vincenzopalazzo: ACK bitcoin/bitcoin@1c07500 Tree-SHA512: bddf728d5d376659155f5bbeb1fa0d42aa273ec4a0cf5687f4d3f3be85625f541d392f30008e3c9d2c65967cb882deb36af34330994727771be73c9adeb521e0
2 parents 52ddbd5 + 1c07500 commit 5a80086

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

contrib/seeds/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ data. Run the following commands from the `/contrib/seeds` directory:
1313

1414
curl https://bitcoin.sipa.be/seeds.txt.gz | gzip -dc > seeds_main.txt
1515
curl https://bitcoin.sipa.be/asmap-filled.dat > asmap-filled.dat
16-
python3 makeseeds.py -a asmap-filled.dat < seeds_main.txt > nodes_main.txt
16+
python3 makeseeds.py -a asmap-filled.dat -s seeds_main.txt > nodes_main.txt
1717
cat nodes_main_manual.txt >> nodes_main.txt
1818
python3 generate-seeds.py . > ../../src/chainparamsseeds.h

contrib/seeds/makeseeds.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ def ip_stats(ips: List[Dict]) -> str:
173173
def parse_args():
174174
argparser = argparse.ArgumentParser(description='Generate a list of bitcoin node seed ip addresses.')
175175
argparser.add_argument("-a","--asmap", help='the location of the asmap asn database file (required)', required=True)
176+
argparser.add_argument("-s","--seeds", help='the location of the DNS seeds file (required)', required=True)
176177
return argparser.parse_args()
177178

178179
def main():
@@ -184,7 +185,8 @@ def main():
184185
print('Done.', file=sys.stderr)
185186

186187
print('Loading and parsing DNS seeds…', end='', file=sys.stderr, flush=True)
187-
lines = sys.stdin.readlines()
188+
with open(args.seeds, 'r', encoding='utf8') as f:
189+
lines = f.readlines()
188190
ips = [parseline(line) for line in lines]
189191
print('Done.', file=sys.stderr)
190192

0 commit comments

Comments
 (0)