Browse Source

less banning, more ignoring

pull/1/head
Pieter Wuille 13 years ago
parent
commit
688c68aca4
  1. 3
      bitcoin.cpp
  2. 17
      db.h
  3. 4
      main.cpp

3
bitcoin.cpp

@ -134,7 +134,8 @@ class CNode { @@ -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

@ -103,16 +103,15 @@ public: @@ -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;
}
@ -204,6 +203,12 @@ public: @@ -204,6 +203,12 @@ public:
}
}
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;
SHARED_CRITICAL_BLOCK(cs) {

4
main.cpp

@ -305,6 +305,7 @@ extern "C" void* ThreadStats(void*) { @@ -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) { @@ -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…
Cancel
Save