net: add an add_even_if_unreachable argument to AddLocal

Prepare for letting explicitly configured local addresses bypass the
reachable-net filter without tying that behavior to LOCAL_MANUAL score.

Pass an `add_even_if_unreachable` bool through `AddLocal()`, defaulting
to `false`.
This commit is contained in:
will
2026-03-20 10:39:30 +00:00
parent ef499680c8
commit f4af02e827
2 changed files with 5 additions and 5 deletions

View File

@@ -274,7 +274,7 @@ void ClearLocal()
}
// learn a new local address
bool AddLocal(const CService& addr_, int nScore)
bool AddLocal(const CService& addr_, int nScore, bool add_even_if_unreachable)
{
CService addr{MaybeFlipIPv6toCJDNS(addr_)};
@@ -304,9 +304,9 @@ bool AddLocal(const CService& addr_, int nScore)
return true;
}
bool AddLocal(const CNetAddr &addr, int nScore)
bool AddLocal(const CNetAddr& addr, int nScore, bool add_even_if_unreachable)
{
return AddLocal(CService(addr, GetListenPort()), nScore);
return AddLocal(CService(addr, GetListenPort()), nScore, add_even_if_unreachable);
}
void RemoveLocal(const CService& addr)

View File

@@ -164,8 +164,8 @@ enum
std::optional<CService> GetLocalAddrForPeer(CNode& node);
void ClearLocal();
bool AddLocal(const CService& addr, int nScore = LOCAL_NONE);
bool AddLocal(const CNetAddr& addr, int nScore = LOCAL_NONE);
bool AddLocal(const CService& addr, int nScore = LOCAL_NONE, bool add_even_if_unreachable = false);
bool AddLocal(const CNetAddr& addr, int nScore = LOCAL_NONE, bool add_even_if_unreachable = false);
void RemoveLocal(const CService& addr);
bool SeenLocal(const CService& addr);
bool IsLocal(const CService& addr);