Merge pull request #8 from luke-jr/bugfix_lowheight

Include low-height nodes in dnsseed.dump
This commit is contained in:
Pieter Wuille 2013-04-15 01:57:08 -07:00
commit e1876bf199
2 changed files with 6 additions and 8 deletions

View file

@ -7,8 +7,6 @@
#include "uint256.h" #include "uint256.h"
#define BITCOIN_SEED_NONCE 0x0539a019ca550825 #define BITCOIN_SEED_NONCE 0x0539a019ca550825
#define REQUIRE_HEIGHT 230000
#define MIN_VERSION 40000
using namespace std; using namespace std;
@ -109,11 +107,7 @@ class CNode {
vRecv >> strSubVer; vRecv >> strSubVer;
if (nVersion >= 209 && !vRecv.empty()) if (nVersion >= 209 && !vRecv.empty())
vRecv >> nStartingHeight; vRecv >> nStartingHeight;
if (nStartingHeight && nStartingHeight < REQUIRE_HEIGHT) {
// give them a day to catch up
ban = 86400;
return true;
}
if (nVersion >= 209) { if (nVersion >= 209) {
BeginMessage("verack"); BeginMessage("verack");
EndMessage(); EndMessage();

6
db.h
View file

@ -12,6 +12,9 @@
#define MIN_RETRY 1000 #define MIN_RETRY 1000
#define REQUIRE_HEIGHT 230000
#define REQUIRE_VERSION 40000
std::string static inline ToString(const CService &ip) { std::string static inline ToString(const CService &ip) {
std::string str = ip.ToString(); std::string str = ip.ToString();
while (str.size() < 22) str += ' '; while (str.size() < 22) str += ' ';
@ -90,7 +93,8 @@ public:
if (ip.GetPort() != 8333) return false; if (ip.GetPort() != 8333) return false;
if (!(services & NODE_NETWORK)) return false; if (!(services & NODE_NETWORK)) return false;
if (!ip.IsRoutable()) return false; if (!ip.IsRoutable()) return false;
if (clientVersion && clientVersion < 32400) return false; if (clientVersion && clientVersion < REQUIRE_VERSION) return false;
if (blocks && blocks < REQUIRE_HEIGHT) return false;
if (total <= 3 && success * 2 >= total) return true; if (total <= 3 && success * 2 >= total) return true;