Bugfix: Allow mining on top of old tip blocks for testnet (fixes testnet-in-a-box use case)

pull/227/head
Luke Dashjr 10 years ago committed by Adrian Gallagher
parent 6e3871b096
commit 3979267180

@ -125,6 +125,7 @@ public:
nMinerThreads = 0;
nTargetTimespan = 3.5 * 24 * 60 * 60; // 3.5 days
nTargetSpacing = 2.5 * 60; // 2.5 minutes
nMaxTipAge = 24 * 60 * 60;
/**
* Build the genesis block. Note that the output of the genesis coinbase cannot
@ -209,6 +210,7 @@ public:
nMinerThreads = 0;
nTargetTimespan = 3.5 * 24 * 60 * 60; // 3.5 days
nTargetSpacing = 2.5 * 60; // 2.5 minutes
nMaxTipAge = 0x7fffffff;
//! Modify the testnet genesis block so the timestamp is valid for a later start.
genesis.nTime = 1317798646;
@ -268,6 +270,7 @@ public:
nTargetTimespan = 3.5 * 24 * 60 * 60; // 3.5 days
nTargetSpacing = 2.5 * 60; // 2.5 minutes
bnProofOfWorkLimit = ~uint256(0) >> 1;
nMaxTipAge = 24 * 60 * 60;
genesis.nTime = 1296688602;
genesis.nBits = 0x207fffff;
genesis.nNonce = 0;

@ -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 */
@ -98,6 +99,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;

@ -1257,6 +1257,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;
@ -1264,7 +1265,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;

Loading…
Cancel
Save