Convert the pnSeed6 array into usable address objects.
| 126 | |
| 127 | //! Convert the pnSeed6 array into usable address objects. |
| 128 | static 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 |
no test coverage detected