@@ -134,11 +134,12 @@ static std::vector<CAddress> convertSeed6(const std::vector<SeedSpec6> &vSeedsIn
134
134
const int64_t nOneWeek = 7 *24 *60 *60 ;
135
135
std::vector<CAddress> vSeedsOut;
136
136
vSeedsOut.reserve (vSeedsIn.size ());
137
+ FastRandomContext rng;
137
138
for (const auto & seed_in : vSeedsIn) {
138
139
struct in6_addr ip;
139
140
memcpy (&ip, seed_in.addr , sizeof (ip));
140
141
CAddress addr (CService (ip, seed_in.port ), GetDesirableServiceFlags (NODE_NONE));
141
- addr.nTime = GetTime () - GetRand (nOneWeek) - nOneWeek;
142
+ addr.nTime = GetTime () - rng. randrange (nOneWeek) - nOneWeek;
142
143
vSeedsOut.push_back (addr);
143
144
}
144
145
return vSeedsOut;
@@ -189,16 +190,16 @@ void AdvertiseLocal(CNode *pnode)
189
190
// If discovery is enabled, sometimes give our peer the address it
190
191
// tells us that it sees us as in case it has a better idea of our
191
192
// address than we do.
193
+ FastRandomContext rng;
192
194
if (IsPeerAddrLocalGood (pnode) && (!addrLocal.IsRoutable () ||
193
- GetRand ((GetnScore (addrLocal) > LOCAL_MANUAL) ? 8 : 2 ) == 0 ))
195
+ rng. randbits ((GetnScore (addrLocal) > LOCAL_MANUAL) ? 3 : 1 ) == 0 ))
194
196
{
195
197
addrLocal.SetIP (pnode->GetAddrLocal ());
196
198
}
197
199
if (addrLocal.IsRoutable () || gArgs .GetBoolArg (" -addrmantest" , false ))
198
200
{
199
201
LogPrint (BCLog::NET, " AdvertiseLocal: advertising address %s\n " , addrLocal.ToString ());
200
- FastRandomContext insecure_rand;
201
- pnode->PushAddress (addrLocal, insecure_rand);
202
+ pnode->PushAddress (addrLocal, rng);
202
203
}
203
204
}
204
205
}
0 commit comments