mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 05:57:59 +01:00
Merge bitcoin/bitcoin#26078: p2p: return CSubNet in LookupSubNet
fb3e812277p2p: return `CSubNet` in `LookupSubNet` (brunoerg) Pull request description: Analyzing the usage of `LookupSubNet`, noticed that most cases uses check if the subnet is valid by calling `subnet.IsValid()`, and the boolean returned by `LookupSubNet` hasn't been used so much, see:29d540b7ad/src/httpserver.cpp (L172-L174)29d540b7ad/src/net_permissions.cpp (L114-L116)It makes sense to return `CSubNet` instead of `bool`. ACKs for top commit: achow101: ACKfb3e812277vasild: ACKfb3e812277theStack: Code-review ACKfb3e812277stickies-v: Concept ACK, but Approach ~0 (for now). Reviewed the code (fb3e812277) and it all looks good to me. Tree-SHA512: ba50d6bd5d58dfdbe1ce1faebd80dd8cf8c92ac53ef33519860b83399afffab482d5658cb6921b849d7a3df6d5cea911412850e08f3f4e27f7af510fbde4b254
This commit is contained in:
@@ -227,11 +227,9 @@ CService LookupNumeric(const std::string& name, uint16_t portDefault = 0, DNSLoo
|
||||
* @param[in] subnet_str A string representation of a subnet of the form
|
||||
* `network address [ "/", ( CIDR-style suffix | netmask ) ]`
|
||||
* e.g. "2001:db8::/32", "192.0.2.0/255.255.255.0" or "8.8.8.8".
|
||||
* @param[out] subnet_out Internal subnet representation, if parsable/resolvable
|
||||
* from `subnet_str`.
|
||||
* @returns whether the operation succeeded or not.
|
||||
* @returns a CSubNet object (that may or may not be valid).
|
||||
*/
|
||||
bool LookupSubNet(const std::string& subnet_str, CSubNet& subnet_out);
|
||||
CSubNet LookupSubNet(const std::string& subnet_str);
|
||||
|
||||
/**
|
||||
* Create a TCP socket in the given address family.
|
||||
|
||||
Reference in New Issue
Block a user