MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / convertSeed6

Function convertSeed6

src/net.cpp:128–145  ·  view source on GitHub ↗

Convert the pnSeed6 array into usable address objects.

Source from the content-addressed store, hash-verified

126
127//! Convert the pnSeed6 array into usable address objects.
128static std::vector<CAddress> convertSeed6(const std::vector<SeedSpec6> &vSeedsIn)
129{
130 // It'll only connect to one or two seed nodes because once it connects,
131 // it'll get a pile of addresses with newer timestamps.
132 // Seed nodes are given a random 'last seen time' of between one and two
133 // weeks ago.
134 const int64_t nOneWeek = 7*24*60*60;
135 std::vector<CAddress> vSeedsOut;
136 vSeedsOut.reserve(vSeedsIn.size());
137 for (const auto& seed_in : vSeedsIn) {
138 struct in6_addr ip;
139 memcpy(&ip, seed_in.addr, sizeof(ip));
140 CAddress addr(CService(ip, seed_in.port), GetDesirableServiceFlags(NODE_NONE));
141 addr.nTime = GetTime() - GetRand(nOneWeek) - nOneWeek;
142 vSeedsOut.push_back(addr);
143 }
144 return vSeedsOut;
145}
146
147// get best local address for a particular peer as a CAddress
148// Otherwise, return the unroutable 0.0.0.0 but filled in with

Callers 1

ThreadOpenConnectionsMethod · 0.85

Calls 8

memcpyFunction · 0.85
GetDesirableServiceFlagsFunction · 0.85
GetTimeFunction · 0.85
GetRandFunction · 0.85
CServiceClass · 0.70
reserveMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected