diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2015-04-09 11:50:18 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2015-09-29 19:46:34 +0000 |
commit | e761d7a94ff8b9f638b65b16f5c4ffab6573884a (patch) | |
tree | 4eeaa151e882c0c0e33c4be97048194fd8aad1b3 | |
parent | 5fb5c9b21335edfe193513ae3fe3f09c1cefe24b (diff) | |
download | bitcoin-e761d7a94ff8b9f638b65b16f5c4ffab6573884a.tar.xz |
Bugfix: Allow mining on top of old tip blocks for testnet (fixes testnet-in-a-box use case)
-rw-r--r-- | src/chainparams.cpp | 3 | ||||
-rw-r--r-- | src/chainparams.h | 2 | ||||
-rw-r--r-- | src/main.cpp | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 623104690a..08303d61ca 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -89,6 +89,7 @@ public: pchMessageStart[3] = 0xd9; vAlertPubKey = ParseHex("04fc9702847840aaf195de8442ebecedf5b095cdbb9bc716bda9110971b28a49e0ead8564ff0db22209e0374782c093bb899692d524e9d6a6956e7c5ecbcd68284"); nDefaultPort = 8333; + nMaxTipAge = 24 * 60 * 60; nPruneAfterHeight = 100000; genesis = CreateGenesisBlock(1231006505, 2083236893, 0x1d00ffff, 1, 50 * COIN); @@ -162,6 +163,7 @@ public: pchMessageStart[3] = 0x07; vAlertPubKey = ParseHex("04302390343f91cc401d56d68b123028bf52e5fca1939df127f63c6467cdf9c8e2c14b61104cf817d0b780da337893ecc4aaff1309e536162dabbdb45200ca2b0a"); nDefaultPort = 18333; + nMaxTipAge = 0x7fffffff; nPruneAfterHeight = 1000; genesis = CreateGenesisBlock(1296688602, 414098458, 0x1d00ffff, 1, 50 * COIN); @@ -222,6 +224,7 @@ public: pchMessageStart[1] = 0xbf; pchMessageStart[2] = 0xb5; pchMessageStart[3] = 0xda; + nMaxTipAge = 24 * 60 * 60; nDefaultPort = 18444; nPruneAfterHeight = 1000; diff --git a/src/chainparams.h b/src/chainparams.h index 66d865b620..465e6a61a8 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -57,6 +57,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; } @@ -76,6 +77,7 @@ protected: //! Raw pub key bytes for the broadcast alert signing key. std::vector<unsigned char> vAlertPubKey; int nDefaultPort; + long nMaxTipAge; uint64_t nPruneAfterHeight; std::vector<CDNSSeedData> vSeeds; std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES]; diff --git a/src/main.cpp b/src/main.cpp index d470ba9003..8da2a80bb0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1091,7 +1091,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; |