heuristics update

This commit is contained in:
Pieter Wuille 2013-06-09 09:31:39 +02:00
parent f5e94ac5fd
commit dc4d06e568

12
db.h
View file

@ -116,15 +116,17 @@ public:
int GetBanTime() const {
if (IsGood()) return 0;
if (clientVersion && clientVersion < 31900) { return 604800; }
if (stat1M.reliability - stat1M.weight + 1.0 < 0.04 && stat1M.count > 2) { return 30*86400; }
if (stat1M.reliability - stat1M.weight + 1.0 < 0.15 && stat1M.count > 32) { return 30*86400; }
if (stat1W.reliability - stat1W.weight + 1.0 < 0.10 && stat1W.count > 16) { return 7*86400; }
if (stat1D.reliability - stat1D.weight + 1.0 < 0.05 && stat1D.count > 8) { return 1*86400; }
return 0;
}
int GetIgnoreTime() const {
if (IsGood()) return 0;
if (stat1M.reliability - stat1M.weight + 1.0 < 0.08 && stat1M.count > 1) { return 10*86400; }
if (stat1W.reliability - stat1W.weight + 1.0 < 0.12 && stat1W.count > 1) { return 3*86400; }
if (stat1D.reliability - stat1D.weight + 1.0 < 0.16 && stat1D.count > 1) { return 8*3600; }
if (stat8H.reliability - stat8H.weight + 1.0 < 0.20 && stat8H.count > 1) { return 2*3600; }
if (stat1M.reliability - stat1M.weight + 1.0 < 0.20 && stat1M.count > 2) { return 10*86400; }
if (stat1W.reliability - stat1W.weight + 1.0 < 0.16 && stat1W.count > 2) { return 3*86400; }
if (stat1D.reliability - stat1D.weight + 1.0 < 0.12 && stat1D.count > 2) { return 8*3600; }
if (stat8H.reliability - stat8H.weight + 1.0 < 0.08 && stat8H.count > 2) { return 2*3600; }
return 0;
}