Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/db.h
Show All 30 Lines | |||||
private: | private: | ||||
float weight; | float weight; | ||||
float count; | float count; | ||||
float reliability; | float reliability; | ||||
public: | public: | ||||
CAddrStat() : weight(0), count(0), reliability(0) {} | CAddrStat() : weight(0), count(0), reliability(0) {} | ||||
void Update(bool good, int64 age, double tau) { | void Update(bool good, int64_t age, double tau) { | ||||
double f = exp(-age / tau); | double f = exp(-age / tau); | ||||
reliability = reliability * f + (good ? (1.0 - f) : 0); | reliability = reliability * f + (good ? (1.0 - f) : 0); | ||||
count = count * f + 1; | count = count * f + 1; | ||||
weight = weight * f + (1.0 - f); | weight = weight * f + (1.0 - f); | ||||
} | } | ||||
IMPLEMENT_SERIALIZE(READWRITE(weight); READWRITE(count); | IMPLEMENT_SERIALIZE(READWRITE(weight); READWRITE(count); | ||||
READWRITE(reliability);) | READWRITE(reliability);) | ||||
Show All 12 Lines | public: | ||||
bool fGood; | bool fGood; | ||||
uint64_t services; | uint64_t services; | ||||
}; | }; | ||||
class CAddrInfo { | class CAddrInfo { | ||||
private: | private: | ||||
CService ip; | CService ip; | ||||
uint64_t services; | uint64_t services; | ||||
int64 lastTry; | int64_t lastTry; | ||||
int64 ourLastTry; | int64_t ourLastTry; | ||||
int64 ourLastSuccess; | int64_t ourLastSuccess; | ||||
int64 ignoreTill; | int64_t ignoreTill; | ||||
CAddrStat stat2H; | CAddrStat stat2H; | ||||
CAddrStat stat8H; | CAddrStat stat8H; | ||||
CAddrStat stat1D; | CAddrStat stat1D; | ||||
CAddrStat stat1W; | CAddrStat stat1W; | ||||
CAddrStat stat1M; | CAddrStat stat1M; | ||||
int clientVersion; | int clientVersion; | ||||
int blocks; | int blocks; | ||||
int total; | int total; | ||||
▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | |||||
struct CServiceResult { | struct CServiceResult { | ||||
CService service; | CService service; | ||||
bool fGood; | bool fGood; | ||||
int nBanTime; | int nBanTime; | ||||
int nHeight; | int nHeight; | ||||
int nClientV; | int nClientV; | ||||
std::string strClientV; | std::string strClientV; | ||||
int64 ourLastSuccess; | int64_t ourLastSuccess; | ||||
}; | }; | ||||
// seen nodes | // seen nodes | ||||
// / \ | // / \ | ||||
// (a) banned nodes available nodes-------------- | // (a) banned nodes available nodes-------------- | ||||
// / | \ | // / | \ | ||||
// tracked nodes (b) unknown nodes (e) active nodes | // tracked nodes (b) unknown nodes (e) active nodes | ||||
// / \ | // / \ | ||||
▲ Show 20 Lines • Show All 192 Lines • Show Last 20 Lines |