Skip to content

Commit 51ae766

Browse files
committed
Use GetDesireableServiceFlags in static seeds, document this.
4440710 broke inserting entries into addrman from static seeds (as well as dnsseeds which did not support service bits). Static seeds were already being filtered by UA for 0.13.1+ (ie NODE_WITNESS), so simply changing the default service bits to include NODE_WITNESS (and updating docs appropriately) is sufficient. For DNS Seeds, we will later fix by falling back to oneshot if a seed does not support filtering.
1 parent fb6f6b1 commit 51ae766

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

contrib/seeds/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ Utility to generate the seeds.txt list that is compiled into the client
44
(see [src/chainparamsseeds.h](/src/chainparamsseeds.h) and other utilities in [contrib/seeds](/contrib/seeds)).
55

66
Be sure to update `PATTERN_AGENT` in `makeseeds.py` to include the current version,
7-
and remove old versions as necessary.
7+
and remove old versions as necessary (at a minimum when GetDesireableServiceFlags
8+
changes its default return value, as those are the services which seeds are added
9+
to addrman with).
810

911
The seeds compiled into the release are created from sipa's DNS seed data, like this:
1012

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ static std::vector<CAddress> convertSeed6(const std::vector<SeedSpec6> &vSeedsIn
136136
for (const auto& seed_in : vSeedsIn) {
137137
struct in6_addr ip;
138138
memcpy(&ip, seed_in.addr, sizeof(ip));
139-
CAddress addr(CService(ip, seed_in.port), NODE_NETWORK);
139+
CAddress addr(CService(ip, seed_in.port), GetDesirableServiceFlags(NODE_NONE));
140140
addr.nTime = GetTime() - GetRand(nOneWeek) - nOneWeek;
141141
vSeedsOut.push_back(addr);
142142
}

src/protocol.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,15 @@ enum ServiceFlags : uint64_t {
291291
* unless they set NODE_NETWORK_LIMITED and we are out of IBD, in which
292292
* case NODE_NETWORK_LIMITED suffices).
293293
*
294-
* Thus, generally, avoid calling with peerServices == NODE_NONE.
294+
* Thus, generally, avoid calling with peerServices == NODE_NONE, unless
295+
* state-specific flags must absolutely be avoided. When called with
296+
* peerServices == NODE_NONE, the returned desirable service flags are
297+
* guaranteed to not change dependant on state - ie they are suitable for
298+
* use when describing peers which we know to be desirable, but for which
299+
* we do not have a confirmed set of service flags.
300+
*
301+
* If the NODE_NONE return value is changed, contrib/seeds/makeseeds.py
302+
* should be updated appropriately to filter for the same nodes.
295303
*/
296304
static ServiceFlags GetDesirableServiceFlags(ServiceFlags services) {
297305
return ServiceFlags(NODE_NETWORK | NODE_WITNESS);

0 commit comments

Comments
 (0)