aboutsummaryrefslogtreecommitdiff
path: root/src/httpserver.cpp
diff options
context:
space:
mode:
authorAndrew Chow <github@achow101.com>2023-10-26 14:21:40 -0400
committerAndrew Chow <github@achow101.com>2023-10-26 14:29:47 -0400
commit7be62df80ff4d1339c039c6589232e50274b4b1a (patch)
treeaded303313ab98f3466f4af22e916090f5ea64af /src/httpserver.cpp
parent5572f98f058543eb87922b4a1bd6fccf91364aa9 (diff)
parentfb3e812277041f239b97b88689a5076796d75b9b (diff)
downloadbitcoin-7be62df80ff4d1339c039c6589232e50274b4b1a.tar.xz
Merge bitcoin/bitcoin#26078: p2p: return `CSubNet` in `LookupSubNet`
fb3e812277041f239b97b88689a5076796d75b9b p2p: 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: https://github.com/bitcoin/bitcoin/blob/29d540b7ada890dd588c4825d40c27c5e6f20061/src/httpserver.cpp#L172-L174 https://github.com/bitcoin/bitcoin/blob/29d540b7ada890dd588c4825d40c27c5e6f20061/src/net_permissions.cpp#L114-L116 It makes sense to return `CSubNet` instead of `bool`. ACKs for top commit: achow101: ACK fb3e812277041f239b97b88689a5076796d75b9b vasild: ACK fb3e812277041f239b97b88689a5076796d75b9b theStack: Code-review ACK fb3e812277041f239b97b88689a5076796d75b9b stickies-v: Concept ACK, but Approach ~0 (for now). Reviewed the code (fb3e812277041f239b97b88689a5076796d75b9b) and it all looks good to me. Tree-SHA512: ba50d6bd5d58dfdbe1ce1faebd80dd8cf8c92ac53ef33519860b83399afffab482d5658cb6921b849d7a3df6d5cea911412850e08f3f4e27f7af510fbde4b254
Diffstat (limited to 'src/httpserver.cpp')
-rw-r--r--src/httpserver.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/httpserver.cpp b/src/httpserver.cpp
index 647e36adb3..4c14c5b939 100644
--- a/src/httpserver.cpp
+++ b/src/httpserver.cpp
@@ -224,8 +224,7 @@ static bool InitHTTPAllowList()
rpc_allow_subnets.emplace_back(LookupHost("127.0.0.1", false).value(), 8); // always allow IPv4 local subnet
rpc_allow_subnets.emplace_back(LookupHost("::1", false).value()); // always allow IPv6 localhost
for (const std::string& strAllow : gArgs.GetArgs("-rpcallowip")) {
- CSubNet subnet;
- LookupSubNet(strAllow, subnet);
+ const CSubNet subnet{LookupSubNet(strAllow)};
if (!subnet.IsValid()) {
uiInterface.ThreadSafeMessageBox(
strprintf(Untranslated("Invalid -rpcallowip subnet specification: %s. Valid are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24)."), strAllow),