-
Notifications
You must be signed in to change notification settings - Fork 38.7k
scripts: Read suspicious hosts from a file instead of hardcoding #17823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
contrib/seeds/makeseeds.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Slightly shorter using strip() and RAII:
with open("suspicious_hosts.txt") as f:
SUSPICIOUS_HOSTS = {s.strip() for s in f if s.strip()}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Slightly shorter using
strip()and RAII:with open("suspicious_hosts.txt") as f: SUSPICIOUS_HOSTS = {s.strip() for s in f if s.strip()}
Didn't know that strip() would work in this case, just changed it
|
Please squash and use a more descriptive commit message + PR title :) Suggestion: Also you might want to sort the entries in BTW, welcome as a contributor! :) |
what do you mean sort entries? |
Sort the lines in the file :)
|
Seems pretty pointless, but I did it anyways. |
The reason to sort entries is that it makes it clear where in the file to add new entries in the future. In unsorted files people typically append new entries to the end of the file which is likely to cause merge conflicts if two different PR:s add entries to the same file. Thus sorting the file will help avoid future merge conflicts :) Makes sense? :) |
Oh, I thought you mean that people were just idiots and didn't know how to append to a file. Thanks for the explanation! |
|
ack b9eb76ece28b4e86b94ecad32f6b5fb35310a7ef |
|
Thank you! |
|
A few linter issues: |
fixed, I think |
|
@sanjaykdragon Can you squash your commits. |
|
ACK e1c582c -- diff looks correct |
|
@laanwj you mind merging this? |
| "54.66.214.167", "54.66.220.137", "54.67.33.14", "54.77.251.214", | ||
| "54.94.195.96", "54.94.200.247" | ||
| } | ||
| with open("suspicious_hosts.txt", mode="r", encoding="utf-8") as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure this tries to read the file in the pwd, not in this folder. Is the script required to run in this folder, so that pwd==this folder already holds for other reasons?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure this tries to read the file in the pwd, not in this folder. Is the script required to run in this folder, so that
pwd==this folderalready holds for other reasons?
Not sure where this script is supposed to be run from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's supposed to be run from the folder it is in, at least according to the instructions in the README (that I always follow): https://github.com/bitcoin/bitcoin/blob/master/contrib/seeds/README.md
(would make sense to make this path configurable, though, for example through a command line option)
…ardcoding e1c582c contrib: makeseeds: Read suspicious hosts from a file instead of hardcoding (Sanjay K) Pull request description: referring to: #17020 good first issue: reading SUSPICIOUS_HOSTS from a file. I haven't changed the base hosts that were included in the original source, just made it readable from a file. ACKs for top commit: practicalswift: ACK e1c582c -- diff looks correct Tree-SHA512: 18684abc1c02cf52d63f6f6ecd98df01a9574a7c470524c37e152296504e2e3ffbabd6f3208214b62031512aeb809a6d37446af82c9f480ff14ce4c42c98e7c2
…ad of hardcoding e1c582c contrib: makeseeds: Read suspicious hosts from a file instead of hardcoding (Sanjay K) Pull request description: referring to: bitcoin#17020 good first issue: reading SUSPICIOUS_HOSTS from a file. I haven't changed the base hosts that were included in the original source, just made it readable from a file. ACKs for top commit: practicalswift: ACK e1c582c -- diff looks correct Tree-SHA512: 18684abc1c02cf52d63f6f6ecd98df01a9574a7c470524c37e152296504e2e3ffbabd6f3208214b62031512aeb809a6d37446af82c9f480ff14ce4c42c98e7c2
…ad of hardcoding e1c582c contrib: makeseeds: Read suspicious hosts from a file instead of hardcoding (Sanjay K) Pull request description: referring to: bitcoin#17020 good first issue: reading SUSPICIOUS_HOSTS from a file. I haven't changed the base hosts that were included in the original source, just made it readable from a file. ACKs for top commit: practicalswift: ACK e1c582c -- diff looks correct Tree-SHA512: 18684abc1c02cf52d63f6f6ecd98df01a9574a7c470524c37e152296504e2e3ffbabd6f3208214b62031512aeb809a6d37446af82c9f480ff14ce4c42c98e7c2
referring to: #17020
good first issue: reading SUSPICIOUS_HOSTS from a file.
I haven't changed the base hosts that were included in the original source, just made it readable from a file.