aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2015-04-09 11:50:18 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2015-11-06 19:58:25 +0000
commitcf67d8b49b59d66bc0e079a31ca547834dd49161 (patch)
tree70247df54bb2d56cb92e92a3dc12a0a01b0bb98a /src
parentb3964e3b7a91547d2080206361a401d6ad615777 (diff)
Bugfix: Allow mining on top of old tip blocks for testnet (fixes testnet-in-a-box use case)
Diffstat (limited to 'src')
-rw-r--r--src/chainparams.cpp3
-rw-r--r--src/chainparams.h2
-rw-r--r--src/main.cpp3
3 files changed, 7 insertions, 1 deletions
diff --git a/src/chainparams.cpp b/src/chainparams.cpp
index ffcbaceb0a..244d8ff0e7 100644
--- a/src/chainparams.cpp
+++ b/src/chainparams.cpp
@@ -122,6 +122,7 @@ public:
nMinerThreads = 0;
nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
nTargetSpacing = 10 * 60;
+ nMaxTipAge = 24 * 60 * 60;
/**
* Build the genesis block. Note that the output of the genesis coinbase cannot
@@ -203,6 +204,7 @@ public:
nMinerThreads = 0;
nTargetTimespan = 14 * 24 * 60 * 60; //! two weeks
nTargetSpacing = 10 * 60;
+ nMaxTipAge = 0x7fffffff;
//! Modify the testnet genesis block so the timestamp is valid for a later start.
genesis.nTime = 1296688602;
@@ -260,6 +262,7 @@ public:
nTargetTimespan = 14 * 24 * 60 * 60; //! two weeks
nTargetSpacing = 10 * 60;
bnProofOfWorkLimit = ~uint256(0) >> 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 ef20a88558..4b6ddca357 100644
--- a/src/chainparams.h
+++ b/src/chainparams.h
@@ -69,6 +69,7 @@ public:
int64_t TargetTimespan() const { return nTargetTimespan; }
int64_t TargetSpacing() const { return nTargetSpacing; }
int64_t Interval() const { return nTargetTimespan / nTargetSpacing; }
+ int64_t MaxTipAge() const { return nMaxTipAge; }
/** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */
bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }
/** In the future use NetworkIDString() for RPC fields */
@@ -95,6 +96,7 @@ protected:
int64_t nTargetTimespan;
int64_t nTargetSpacing;
int nMinerThreads;
+ long nMaxTipAge;
std::vector<CDNSSeedData> vSeeds;
std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
CBaseChainParams::Network networkID;
diff --git a/src/main.cpp b/src/main.cpp
index 50e01fa400..dd438f42c7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1248,6 +1248,7 @@ CAmount GetBlockValue(int nHeight, const CAmount& nFees)
bool IsInitialBlockDownload()
{
+ const CChainParams& chainParams = Params();
LOCK(cs_main);
if (fImporting || fReindex || chainActive.Height() < Checkpoints::GetTotalBlocksEstimate())
return true;
@@ -1255,7 +1256,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;