mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
Merge bitcoin/bitcoin#29213: doc, test: test and explain service flag handling
74ebd4d135doc, test: Test and explain service flag handling (Martin Zumsande) Pull request description: Service flags received from the peer-to-peer network are handled differently, depending on how we receive them. If received directly from an outbound peer the flags belong to, they replace existing flags. If received via gossip relay (so that anyone could send them), new flags are added, but existing ones but cannot be overwritten. Document that and add test coverage for it. ACKs for top commit: achow101: ACK74ebd4d135furszy: ACK74ebd4d135brunoerg: utACK74ebd4d135Tree-SHA512: 604adc3304b8e3cb1a10dfd017025c10b029bebd3ef533f96bcb5856fee5d4396a9aed4949908b8e7ef267ad21320d1814dd80f88426330c5c9c2c529c497591
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user