Skip to content

Commit 1c07500

Browse files
committed
contrib: make DNS seeds file an argument in CLI
1 parent a4baf3f commit 1c07500

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)