mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
p2p, refactor: return vector/optional<CService> in Lookup
This commit is contained in:
parent
7799eb125b
commit
34bcdfc6a6
9 changed files with 83 additions and 100 deletions
|
|
@ -88,18 +88,18 @@ bool NetWhitebindPermissions::TryParse(const std::string& str, NetWhitebindPermi
|
|||
if (!TryParsePermissionFlags(str, flags, offset, error)) return false;
|
||||
|
||||
const std::string strBind = str.substr(offset);
|
||||
CService addrBind;
|
||||
if (!Lookup(strBind, addrBind, 0, false)) {
|
||||
const std::optional<CService> addrBind{Lookup(strBind, 0, false)};
|
||||
if (!addrBind.has_value()) {
|
||||
error = ResolveErrMsg("whitebind", strBind);
|
||||
return false;
|
||||
}
|
||||
if (addrBind.GetPort() == 0) {
|
||||
if (addrBind.value().GetPort() == 0) {
|
||||
error = strprintf(_("Need to specify a port with -whitebind: '%s'"), strBind);
|
||||
return false;
|
||||
}
|
||||
|
||||
output.m_flags = flags;
|
||||
output.m_service = addrBind;
|
||||
output.m_service = addrBind.value();
|
||||
error = Untranslated("");
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue