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

Function convertSeed6

src/net.cpp:159–177  ·  view source on GitHub ↗

Convert the pnSeeds6 array into usable address objects.

Source from the content-addressed store, hash-verified

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

Callers 1

ThreadOpenConnectionsFunction · 0.85

Calls 9

memcpyFunction · 0.85
GetTimeFunction · 0.85
GetRandFunction · 0.85
reserveMethod · 0.80
CServiceClass · 0.70
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected