Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/db.cpp
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
int CAddrDb::Lookup_(const CService &ip) { | int CAddrDb::Lookup_(const CService &ip) { | ||||
if (ipToId.count(ip)) { | if (ipToId.count(ip)) { | ||||
return ipToId[ip]; | return ipToId[ip]; | ||||
} | } | ||||
return -1; | return -1; | ||||
} | } | ||||
void CAddrDb::Good_(const CService &addr, int clientV, std::string clientSV, | void CAddrDb::Good_(const CService &addr, int clientV, std::string clientSV, | ||||
int blocks) { | int blocks, uint64_t services) { | ||||
int id = Lookup_(addr); | int id = Lookup_(addr); | ||||
if (id == -1) { | if (id == -1) { | ||||
return; | return; | ||||
} | } | ||||
unkId.erase(id); | unkId.erase(id); | ||||
banned.erase(addr); | banned.erase(addr); | ||||
SeederAddrInfo &info = idToInfo[id]; | SeederAddrInfo &info = idToInfo[id]; | ||||
info.clientVersion = clientV; | info.clientVersion = clientV; | ||||
info.clientSubVersion = clientSV; | info.clientSubVersion = clientSV; | ||||
info.blocks = blocks; | info.blocks = blocks; | ||||
info.services = services; | |||||
info.Update(true); | info.Update(true); | ||||
if (info.IsReliable() && goodId.count(id) == 0) { | if (info.IsReliable() && goodId.count(id) == 0) { | ||||
goodId.insert(id); | goodId.insert(id); | ||||
// tfm::format(std::cout, "%s: good; %i good nodes now\n", | // tfm::format(std::cout, "%s: good; %i good nodes now\n", | ||||
// ToString(addr), (int)goodId.size()); | // ToString(addr), (int)goodId.size()); | ||||
} | } | ||||
nDirty++; | nDirty++; | ||||
ourId.push_back(id); | ourId.push_back(id); | ||||
▲ Show 20 Lines • Show All 130 Lines • Show Last 20 Lines |