diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 5f400b265..c71539397 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -51,6 +51,7 @@ public: vAlertPubKey = ParseHex("04fc9702847840aaf195de8442ebecedf5b095cdbb9bc716bda9110971b28a49e0ead8564ff0db22209e0374782c093bb899692d524e9d6a6956e7c5ecbcd68284"); nDefaultPort = 8333; nMinerThreads = 0; + nMaxTipAge = 24 * 60 * 60; nPruneAfterHeight = 100000; /** @@ -147,6 +148,7 @@ public: vAlertPubKey = ParseHex("04302390343f91cc401d56d68b123028bf52e5fca1939df127f63c6467cdf9c8e2c14b61104cf817d0b780da337893ecc4aaff1309e536162dabbdb45200ca2b0a"); nDefaultPort = 18333; nMinerThreads = 0; + nMaxTipAge = 0x7fffffff; nPruneAfterHeight = 1000; //! Modify the testnet genesis block so the timestamp is valid for a later start. @@ -206,6 +208,7 @@ public: pchMessageStart[2] = 0xb5; pchMessageStart[3] = 0xda; nMinerThreads = 1; + nMaxTipAge = 24 * 60 * 60; genesis.nTime = 1296688602; genesis.nBits = 0x207fffff; genesis.nNonce = 2; diff --git a/src/chainparams.h b/src/chainparams.h index 8044b553e..f61e3db13 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -60,6 +60,7 @@ public: bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; } /** Policy: Filter transactions that do not match well-defined patterns */ bool RequireStandard() const { return fRequireStandard; } + int64_t MaxTipAge() const { return nMaxTipAge; } int64_t PruneAfterHeight() const { return nPruneAfterHeight; } /** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */ bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; } @@ -80,6 +81,7 @@ protected: std::vector vAlertPubKey; int nDefaultPort; int nMinerThreads; + long nMaxTipAge; uint64_t nPruneAfterHeight; std::vector vSeeds; std::vector base58Prefixes[MAX_BASE58_TYPES]; diff --git a/src/main.cpp b/src/main.cpp index 77d9227f5..29a84054a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1239,7 +1239,7 @@ bool IsInitialBlockDownload() if (lockIBDState) return false; bool state = (chainActive.Height() < pindexBestHeader->nHeight - 24 * 6 || - pindexBestHeader->GetBlockTime() < GetTime() - 24 * 60 * 60); + pindexBestHeader->GetBlockTime() < GetTime() - chainParams.MaxTipAge()); if (!state) lockIBDState = true; return state;