From 688c68aca4030e4e409699f76e20b83f47829cbd Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Wed, 30 May 2012 16:51:44 +0200 Subject: [PATCH] less banning, more ignoring --- bitcoin.cpp | 3 ++- db.h | 17 +++++++++++------ main.cpp | 4 +++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/bitcoin.cpp b/bitcoin.cpp index ac5a79e..bdb8003 100644 --- a/bitcoin.cpp +++ b/bitcoin.cpp @@ -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; } } diff --git a/db.h b/db.h index d5b5f6d..7eaff7d 100644 --- a/db.h +++ b/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::iterator it = idToInfo.begin(); it != idToInfo.end(); it++) { + (*it).second.ignoreTill = 0; + } + } std::vector GetAll() { std::vector ret; diff --git a/main.cpp b/main.cpp index 35182d8..ce91bc5 100644 --- a/main.cpp +++ b/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 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;