doc, test: Test and explain service flag handling

Service flags are handled differently, depending on whether
validated (if received from the peer) or unvalidated (received
via gossip relay).
This commit is contained in:
Martin Zumsande
2024-01-09 14:04:51 -05:00
parent b3b19be20d
commit 74ebd4d135
3 changed files with 34 additions and 2 deletions

View File

@@ -3376,6 +3376,9 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
vRecv >> CNetAddr::V1(addrMe);
if (!pfrom.IsInboundConn())
{
// Overwrites potentially existing services. In contrast to this,
// unvalidated services received via gossip relay in ADDR/ADDRV2
// messages are only ever added but cannot replace existing ones.
m_addrman.SetServices(pfrom.addr, nServices);
}
if (pfrom.ExpectServicesFromConn() && !HasAllDesirableServiceFlags(nServices))