Introduce nOneWeek constant
authorsvost <ya.nowa@yandex.ru>
Wed, 24 Feb 2016 07:01:50 +0000 (10:01 +0300)
committersvost <ya.nowa@yandex.ru>
Wed, 24 Feb 2016 07:07:11 +0000 (10:07 +0300)
src/main.cpp
src/net.cpp
src/util.h

index f3f1d55..970dd7e 100644 (file)
@@ -2347,9 +2347,9 @@ bool CBlock::AcceptBlock()
         return DoS(100, error("AcceptBlock() : incorrect %s", IsProofOfWork() ? "proof-of-work" : "proof-of-stake"));
 
     int64_t nMedianTimePast = pindexPrev->GetMedianTimePast();
-    int nMaxOffset = 12 * 3600; // 12 hours
+    int nMaxOffset = 12 * nOneHour; // 12 hours
     if (pindexPrev->nTime < 1450569600)
-        nMaxOffset = 7 * 86400; // One week until 20 Dec, 2015
+        nMaxOffset = nOneWeek; // One week until 20 Dec, 2015
 
     // Check timestamp against prev
     if (GetBlockTime() <= nMedianTimePast || FutureDrift(GetBlockTime()) < pindexPrev->GetBlockTime())
index d872c7c..756e5cb 100644 (file)
@@ -1181,7 +1181,6 @@ void ThreadOpenConnections2(void* parg)
                 // it'll get a pile of addresses with newer timestamps.
                 // Seed nodes are given a random 'last seen time' of between one and two
                 // weeks ago.
-                const int64_t nOneWeek = 7*24*60*60;
                 struct in_addr ip;
                 memcpy(&ip, &pnSeed[i], sizeof(ip));
                 CAddress addr(CService(ip, GetDefaultPort()));
@@ -1197,7 +1196,6 @@ void ThreadOpenConnections2(void* parg)
             std::vector<CAddress> vAdd;
             for (unsigned int i = 0; i < ARRAYLEN(pchTorSeed); i++)
             {
-                const int64_t nOneWeek = 7*24*60*60;
                 CAddress addr(CService(pchTorSeed[i], GetDefaultPort()));
                 addr.nTime = GetTime()-GetRand(nOneWeek)-nOneWeek;
                 vAdd.push_back(addr);
index f4b872c..c8ae742 100644 (file)
@@ -37,6 +37,7 @@
 
 static const int32_t nOneHour = 60 * 60;
 static const int32_t nOneDay = 24 * 60 * 60;
+static const int64_t nOneWeek = 7 * 24 * 60 * 60;
 
 static const int64_t COIN = 1000000;
 static const int64_t CENT = 10000;