Skip to content
Permalink
Browse files

Bugfix: Allow mining on top of old tip blocks for testnet (fixes test…

…net-in-a-box use case)
  • Loading branch information...
luke-jr committed Apr 9, 2015
1 parent 87a797a commit 33d6825c6f91e99de65555d5f869134cfa54d967
Showing with 6 additions and 1 deletion.
  1. +3 −0 src/chainparams.cpp
  2. +2 −0 src/chainparams.h
  3. +1 −1 src/main.cpp
@@ -51,6 +51,7 @@ class CMainParams : public CChainParams {
vAlertPubKey = ParseHex("04fc9702847840aaf195de8442ebecedf5b095cdbb9bc716bda9110971b28a49e0ead8564ff0db22209e0374782c093bb899692d524e9d6a6956e7c5ecbcd68284");
nDefaultPort = 8333;
nMinerThreads = 0;
nMaxTipAge = 24 * 60 * 60;
nPruneAfterHeight = 100000;

/**
@@ -147,6 +148,7 @@ class CTestNetParams : public CMainParams {
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 @@ class CRegTestParams : public CTestNetParams {
pchMessageStart[2] = 0xb5;
pchMessageStart[3] = 0xda;
nMinerThreads = 1;
nMaxTipAge = 24 * 60 * 60;
genesis.nTime = 1296688602;
genesis.nBits = 0x207fffff;
genesis.nNonce = 2;
@@ -60,6 +60,7 @@ class CChainParams
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 @@ class CChainParams
std::vector<unsigned char> vAlertPubKey;
int nDefaultPort;
int nMinerThreads;
long nMaxTipAge;
uint64_t nPruneAfterHeight;
std::vector<CDNSSeedData> vSeeds;
std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
@@ -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;

0 comments on commit 33d6825

Please sign in to comment.
You can’t perform that action at this time.