-
Notifications
You must be signed in to change notification settings - Fork 38.7k
p2p, refactor: tidy up LookupSubNet() #23219
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
|
Concept ACK |
7f146ab to
eb66966
Compare
|
Thanks @vasild, updated with your feedback per |
eb66966 to
aa71b3c
Compare
vasild
left a comment
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.
ACK aa71b3c88ffadf7250a5bacd20d65bf9cc2f1267
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
stratospher
left a comment
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.
tested ACK aa71b3c
Agree that the CNetAddr vector is unnecessary in src/netbase.cpp. The comments and variable name updates look great too! Confirmed that the changes don’t affect the unit tests which include the netbase.h header file. The tests run successfully:
- addrman_tests.cpp
- net_tests.cpp
- netbase_tests.cpp
|
The same TODO is being solved in #17160. |
|
Needs rebase after #17160 |
aa71b3c to
49183e4
Compare
|
Thanks, rebased and updated the title and description. |
vasild
left a comment
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.
ACK 49183e465100715d44f91ca865432ddf71de14fe
|
Rebased before the merge causing OOM in the CI and dropped an uneeded param per #23219 (comment). |
49183e4 to
d0e0335
Compare
- consistent param naming between function declaration and definition - brackets, param naming and localvar naming per current standards in doc/developer-notes.md - update/improve doxygen documentation in the declaration - improve comments and other localvar names - constness - named args
d0e0335 to
c44c201
Compare
vasild
left a comment
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.
ACK c44c201
| } | ||
|
|
||
| bool LookupSubNet(const std::string& strSubnet, CSubNet& ret, DNSLookupFn dns_lookup_function) | ||
| bool LookupSubNet(const std::string& subnet_str, CSubNet& subnet_out) |
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.
Thinking of it, a better API would be to return option<CSubNet> instead of a bool and output parameter. But not necessarily in this PR. It's more consistent with the other functions in netbase.h as it is now.
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.
Good idea. I have a branch of netbase follow-ups, could do it there.
|
ACK c44c201 |
shaavan
left a comment
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.
crACK c44c201
c44c201 p2p, refactor: drop unused DNSLookupFn param in LookupSubnet() (Vasil Dimov) f0c9e68 p2p, refactor: tidy up LookupSubNet() (Jon Atack) Pull request description: This pull originally resolved a code `TO-DO`, as well as fixing different param names between the function declaration and definition, updating the function to current style standards, clearer variable naming, and improving the Doxygen documentation. Following the merge of bitcoin#17160, it now does the non-`TODO` changes and also now drops an unused param to simplify the function. ACKs for top commit: dunxen: ACK c44c201 vasild: ACK c44c201 shaavan: crACK c44c201 Tree-SHA512: 55f64c7f403819dec84f4da06e63db50f7c0601a2d9a1ec196fda667c220ec6f5ad2a3c95e0e02275da9f6da6b984275d1dc10e19ed82005c5e13da5c5ecab02
This pull originally resolved a code
TO-DO, as well as fixing different param names between the function declaration and definition, updating the function to current style standards, clearer variable naming, and improving the Doxygen documentation.Following the merge of #17160, it now does the non-
TODOchanges and also now drops an unused param to simplify the function.