net: Clarify that m_addr_local is only set once

Includes a rename from addrLocal to m_addr_local to match the name of
its corresponding Mutex.
This commit is contained in:
MarcoFalke
2024-08-09 13:43:36 +02:00
parent bacab1380e
commit fa6fe43207
3 changed files with 9 additions and 13 deletions

View File

@@ -576,16 +576,14 @@ CService CNode::GetAddrLocal() const
{
AssertLockNotHeld(m_addr_local_mutex);
LOCK(m_addr_local_mutex);
return addrLocal;
return m_addr_local;
}
void CNode::SetAddrLocal(const CService& addrLocalIn) {
AssertLockNotHeld(m_addr_local_mutex);
LOCK(m_addr_local_mutex);
if (addrLocal.IsValid()) {
LogError("Addr local already set for node: %i. Refusing to change from %s to %s\n", id, addrLocal.ToStringAddrPort(), addrLocalIn.ToStringAddrPort());
} else {
addrLocal = addrLocalIn;
if (Assume(!m_addr_local.IsValid())) { // Addr local can only be set once during version msg processing
m_addr_local = addrLocalIn;
}
}