Browse Source

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

pull/145/head
Luke Dashjr 9 years ago
parent
commit
33d6825c6f
  1. 3
      src/chainparams.cpp
  2. 2
      src/chainparams.h
  3. 2
      src/main.cpp

3
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;

2
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<unsigned char> vAlertPubKey;
int nDefaultPort;
int nMinerThreads;
long nMaxTipAge;
uint64_t nPruneAfterHeight;
std::vector<CDNSSeedData> vSeeds;
std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];

2
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;

Loading…
Cancel
Save