diff options
author | Ava Chow <github@achow101.com> | 2024-01-16 13:29:17 -0500 |
---|---|---|
committer | Ava Chow <github@achow101.com> | 2024-01-16 13:35:45 -0500 |
commit | 5711da65885c85ca0dbad2a01e1ef7d6f55e4261 (patch) | |
tree | 4bdaf93ac0a464dbde1aa0c819584d0c5ff31278 /src/net_processing.cpp | |
parent | 27d935f58b9ef5560ddd5914547a6de7884c41e6 (diff) | |
parent | 74ebd4d1359edce82a134dfcd3da9840f8d206e2 (diff) |
Merge bitcoin/bitcoin#29213: doc, test: test and explain service flag handling
74ebd4d1359edce82a134dfcd3da9840f8d206e2 doc, 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:
ACK 74ebd4d1359edce82a134dfcd3da9840f8d206e2
furszy:
ACK 74ebd4d1359edce82a134dfcd3da9840f8d206e2
brunoerg:
utACK 74ebd4d1359edce82a134dfcd3da9840f8d206e2
Tree-SHA512: 604adc3304b8e3cb1a10dfd017025c10b029bebd3ef533f96bcb5856fee5d4396a9aed4949908b8e7ef267ad21320d1814dd80f88426330c5c9c2c529c497591
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r-- | src/net_processing.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 683a7aa10f..80cf610a0d 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -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)) |