MCPcopy Create free account
hub / github.com/LUX-Core/lux / convertSeed6

Function convertSeed6

src/net.cpp:158–175  ·  view source on GitHub ↗

Convert the pnSeed6 array into usable address objects.

Source from the content-addressed store, hash-verified

156
157//! Convert the pnSeed6 array into usable address objects.
158static std::vector<CAddress> convertSeed6(const std::vector<SeedSpec6> &vSeedsIn)
159{
160 // It'll only connect to one or two seed nodes because once it connects,
161 // it'll get a pile of addresses with newer timestamps.
162 // Seed nodes are given a random 'last seen time' of between one and two
163 // weeks ago.
164 const int64_t nOneWeek = 7*24*60*60;
165 std::vector<CAddress> vSeedsOut;
166 vSeedsOut.reserve(vSeedsIn.size());
167 for (const auto& seed_in : vSeedsIn) {
168 struct in6_addr ip;
169 memcpy(&ip, seed_in.addr, sizeof(ip));
170 CAddress addr(CService(ip, seed_in.port), NODE_NETWORK);
171 addr.nTime = GetTime() - GetRand(nOneWeek) - nOneWeek;
172 vSeedsOut.push_back(addr);
173 }
174 return vSeedsOut;
175}
176
177// get best local address for a particular peer as a CAddress
178// Otherwise, return the unroutable 0.0.0.0 but filled in with

Callers 1

ThreadOpenConnectionsFunction · 0.85

Calls 7

memcpyFunction · 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