less banning, more ignoring
This commit is contained in:
parent
9e25ed4ab6
commit
688c68aca4
3 changed files with 16 additions and 8 deletions
|
@ -134,7 +134,8 @@ class CNode {
|
|||
it++;
|
||||
if (addr.nTime <= 100000000 || addr.nTime > now + 600)
|
||||
addr.nTime = now - 5 * 86400;
|
||||
vAddr->push_back(addr);
|
||||
if (addr.nTime > now - 604800)
|
||||
vAddr->push_back(addr);
|
||||
// printf("%s: added address %s (#%i)\n", ToString(you).c_str(), addr.ToString().c_str(), (int)(vAddr->size()));
|
||||
if (vAddr->size() > 1000) {doneAfter = 1; return true; }
|
||||
}
|
||||
|
|
17
db.h
17
db.h
|
@ -103,16 +103,15 @@ public:
|
|||
}
|
||||
int GetBanTime() const {
|
||||
if (IsGood()) return 0;
|
||||
if (clientVersion && clientVersion < 31900) { return 1000000; }
|
||||
if (stat1D.reliability < 0.01 && stat1D.count > 5) { return 500000; }
|
||||
if (stat1W.reliability - stat1W.weight + 1.0 < 0.10 && stat1W.count > 4) { return 10*24*3600; }
|
||||
if (clientVersion && clientVersion < 31900) { return 604800; }
|
||||
return 0;
|
||||
}
|
||||
int GetIgnoreTime() const {
|
||||
if (IsGood()) return 0;
|
||||
if (stat2H.reliability - stat2H.weight + 1.0 < 0.2 && stat2H.count > 3) { return 1*3600; }
|
||||
if (stat8H.reliability - stat8H.weight + 1.0 < 0.2 && stat8H.count > 6) { return 2*3600; }
|
||||
if (stat1D.reliability - stat1D.weight + 1.0 < 0.2 && stat1D.count > 9) { return 3*3600; }
|
||||
if (stat8H.reliability - stat8H.weight + 1.0 < 0.20 && stat8H.count > 6) { return 1*3600; }
|
||||
if (stat1D.reliability - stat1D.weight + 1.0 < 0.16 && stat1D.count > 12) { return 2*3600; }
|
||||
if (stat1W.reliability - stat1W.weight + 1.0 < 0.12 && stat8H.count > 24) { return 4*3600; }
|
||||
if (stat1M.reliability - stat1M.weight + 1.0 < 0.08 && stat1D.count > 48) { return 8*3600; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -203,6 +202,12 @@ public:
|
|||
stats.nAge = time(NULL) - idToInfo[ourId[0]].ourLastTry;
|
||||
}
|
||||
}
|
||||
|
||||
void ResetIgnores() {
|
||||
for (std::map<int, CAddrInfo>::iterator it = idToInfo.begin(); it != idToInfo.end(); it++) {
|
||||
(*it).second.ignoreTill = 0;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<CAddrReport> GetAll() {
|
||||
std::vector<CAddrReport> ret;
|
||||
|
|
4
main.cpp
4
main.cpp
|
@ -305,6 +305,7 @@ extern "C" void* ThreadStats(void*) {
|
|||
static const string seeds[] = {"dnsseed.bluematt.me", "bitseed.xf2.org", "dnsseed.bitcoin.dashjr.org", "seed.bitcoin.sipa.be"};
|
||||
|
||||
extern "C" void* ThreadSeeder(void*) {
|
||||
db.Add(CService("kjy2eqzk4zwi5zd3.onion", 8333), true);
|
||||
do {
|
||||
for (int i=0; i<sizeof(seeds)/sizeof(seeds[0]); i++) {
|
||||
vector<CNetAddr> ips;
|
||||
|
@ -336,7 +337,8 @@ int main(int argc, char **argv) {
|
|||
printf("Loading dnsseed.dat...");
|
||||
CAutoFile cf(f);
|
||||
cf >> db;
|
||||
// db.banned.clear();
|
||||
db.banned.clear();
|
||||
db.ResetIgnores();
|
||||
printf("done\n");
|
||||
}
|
||||
pthread_t threadDns, threadSeed, threadDump, threadStats;
|
||||
|
|
Loading…
Reference in a new issue