Bugfix: Allow mining on top of old tip blocks for testnet (fixes testnet-in-a-box use case)
This commit is contained in:
parent
b3964e3b7a
commit
cf67d8b49b
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue