From 3bdc0abd5d7e262151c62426cb3006433fb21ffc Mon Sep 17 00:00:00 2001 From: svost Date: Wed, 24 Feb 2016 10:01:50 +0300 Subject: [PATCH] Introduce nOneWeek constant --- src/main.cpp | 4 ++-- src/net.cpp | 2 -- src/util.h | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f3f1d55..970dd7e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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()) diff --git a/src/net.cpp b/src/net.cpp index d872c7c..756e5cb 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -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 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); diff --git a/src/util.h b/src/util.h index f4b872c..c8ae742 100644 --- a/src/util.h +++ b/src/util.h @@ -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; -- 1.7.1