Merge pull request #2 from donshin/protocol-version-180004
Updated protocol version to 180004
This commit is contained in:
commit
01faa4b9d9
|
@ -7,8 +7,8 @@ of reliable nodes via a built-in DNS server.
|
||||||
Features:
|
Features:
|
||||||
* regularly revisits known nodes to check their availability
|
* regularly revisits known nodes to check their availability
|
||||||
* bans nodes after enough failures, or bad behaviour
|
* bans nodes after enough failures, or bad behaviour
|
||||||
* accepts nodes down to v0.3.19 to request new IP addresses from,
|
* accepts nodes down to protocol version 180003 to request new IP addresses from,
|
||||||
but only reports good post-v0.3.24 nodes.
|
but only reports good (180004) nodes.
|
||||||
* keeps statistics over (exponential) windows of 2 hours, 8 hours,
|
* keeps statistics over (exponential) windows of 2 hours, 8 hours,
|
||||||
1 day and 1 week, to base decisions on.
|
1 day and 1 week, to base decisions on.
|
||||||
* very low memory (a few tens of megabytes) and cpu requirements.
|
* very low memory (a few tens of megabytes) and cpu requirements.
|
||||||
|
|
7
db.h
7
db.h
|
@ -12,7 +12,8 @@
|
||||||
|
|
||||||
#define MIN_RETRY 1000
|
#define MIN_RETRY 1000
|
||||||
|
|
||||||
#define REQUIRE_VERSION 70001
|
#define REQUIRED_VERSION 180004
|
||||||
|
#define MINIMUM_VERSION_TO_AVOID_BAN_TIME 180003
|
||||||
|
|
||||||
static inline int GetRequireHeight(const bool testnet = fTestNet)
|
static inline int GetRequireHeight(const bool testnet = fTestNet)
|
||||||
{
|
{
|
||||||
|
@ -104,7 +105,7 @@ public:
|
||||||
if (ip.GetPort() != GetDefaultPort()) return false;
|
if (ip.GetPort() != GetDefaultPort()) 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 < REQUIRE_VERSION) return false;
|
if (clientVersion && clientVersion < REQUIRED_VERSION) return false;
|
||||||
if (blocks && blocks < GetRequireHeight()) return false;
|
if (blocks && blocks < GetRequireHeight()) return false;
|
||||||
|
|
||||||
if (total <= 3 && success * 2 >= total) return true;
|
if (total <= 3 && success * 2 >= total) return true;
|
||||||
|
@ -119,7 +120,7 @@ public:
|
||||||
}
|
}
|
||||||
int GetBanTime() const {
|
int GetBanTime() const {
|
||||||
if (IsGood()) return 0;
|
if (IsGood()) return 0;
|
||||||
if (clientVersion && clientVersion < 31900) { return 604800; }
|
if (clientVersion && clientVersion < MINIMUM_VERSION_TO_AVOID_BAN_TIME) { return 604800; }
|
||||||
if (stat1M.reliability - stat1M.weight + 1.0 < 0.15 && stat1M.count > 32) { 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 (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; }
|
if (stat1D.reliability - stat1D.weight + 1.0 < 0.05 && stat1D.count > 8) { return 1*86400; }
|
||||||
|
|
|
@ -60,7 +60,7 @@ class CDataStream;
|
||||||
class CAutoFile;
|
class CAutoFile;
|
||||||
static const unsigned int MAX_SIZE = 0x02000000;
|
static const unsigned int MAX_SIZE = 0x02000000;
|
||||||
|
|
||||||
static const int PROTOCOL_VERSION = 180003;
|
static const int PROTOCOL_VERSION = 180004;
|
||||||
|
|
||||||
// Used to bypass the rule against non-const reference to temporary
|
// Used to bypass the rule against non-const reference to temporary
|
||||||
// where it makes sense with wrappers such as CFlatData or CTxDB
|
// where it makes sense with wrappers such as CFlatData or CTxDB
|
||||||
|
|
Loading…
Reference in New Issue