From 5d22b17af5a949a169d72cced44fd2b7b9d075a7 Mon Sep 17 00:00:00 2001 From: kay kurokawa Date: Thu, 24 May 2018 15:57:18 -0700 Subject: [PATCH 1/3] fix fPowAllowMinDifficultyBlocks implementation on testnet so that it only affects block 277300 and onwards --- src/pow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pow.cpp b/src/pow.cpp index 90d34b4fb..328c19f60 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -18,13 +18,14 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead if (pindexLast == NULL) return nProofOfWorkLimit; - if (params.fPowAllowMinDifficultyBlocks) + if (params.fPowAllowMinDifficultyBlocks && pindexLast->nHeight >= 277299) { // Special difficulty rule for testnet: // If the new block's timestamp is twice the target block time // then allow mining of a min-difficulty block. // This is to prevent the testnet from gettig stuck when a large amount // of hashrate drops off the network. + // This rule was not implemented properly until testnet block 277299. if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + params.nPowTargetSpacing*2){ return nProofOfWorkLimit; } -- 2.45.3 From 11f5bf42430be8b6143f9036246a8323910314df Mon Sep 17 00:00:00 2001 From: kay kurokawa Date: Sun, 27 May 2018 22:57:12 -0700 Subject: [PATCH 2/3] updated version to 0.12.2.0 --- configure.ac | 4 ++-- src/clientversion.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index a419b9249..7445545d5 100644 --- a/configure.ac +++ b/configure.ac @@ -2,8 +2,8 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 12) -define(_CLIENT_VERSION_REVISION, 1) -define(_CLIENT_VERSION_BUILD, 2) +define(_CLIENT_VERSION_REVISION, 2) +define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2016) define(_COPYRIGHT_HOLDERS,[The %s developers]) diff --git a/src/clientversion.h b/src/clientversion.h index 2f0507d1b..e8e8417ca 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -16,8 +16,8 @@ //! These need to be macros, as clientversion.cpp's and bitcoin*-res.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 12 -#define CLIENT_VERSION_REVISION 1 -#define CLIENT_VERSION_BUILD 2 +#define CLIENT_VERSION_REVISION 2 +#define CLIENT_VERSION_BUILD 0 //! Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true -- 2.45.3 From acb222ab42ff1b74e64490e105d7b0184894d00b Mon Sep 17 00:00:00 2001 From: Tzu-Jung Lee Date: Mon, 28 May 2018 10:55:27 -0700 Subject: [PATCH 3/3] cleanup: revert unused changes --- src/chainparams.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 2f7d71c1b..daddb9b72 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -31,7 +31,7 @@ #define REGTEST_GENESIS_HASH "6e3fcf1299d4ec5d79c3a4c91d624a4acf9e2e173d95a1a0504f677669687556" #define REGTEST_GENESIS_NONCE 1 -bool CheckProofOfWork2(uint256 hash, unsigned int nBits, const Consensus::Params& params) +bool CheckProofOfWork2(uint256 hash, unsigned int nBits) { bool fNegative; bool fOverflow; @@ -50,7 +50,7 @@ bool CheckProofOfWork2(uint256 hash, unsigned int nBits, const Consensus::Params return true; } -static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward, const Consensus::Params& consensus) +static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward) { CMutableTransaction txNew; txNew.nVersion = 1; @@ -77,7 +77,7 @@ static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesi while (true) { genesis.nNonce += 1; - if (CheckProofOfWork2(genesis.GetPoWHash(), nBits, consensus)) + if (CheckProofOfWork2(genesis.GetPoWHash(), nBits)) { std::cout << "nonce: " << genesis.nNonce << std::endl; std::cout << "hex: " << genesis.GetHash().GetHex() << std::endl; @@ -100,11 +100,11 @@ static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesi * CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B) * vMerkleTree: 4a5e1e */ -static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward, const Consensus::Params& consensus) +static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward) { const char* pszTimestamp = "insert timestamp string";//"The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"; const CScript genesisOutputScript = CScript() << OP_DUP << OP_HASH160 << ParseHex("345991dbf57bfb014b87006acdfafbfc5fe8292f") << OP_EQUALVERIFY << OP_CHECKSIG; - return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward, consensus); + return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward); } /** @@ -159,7 +159,7 @@ public: nDefaultPort = 9246; nPruneAfterHeight = 100000; - genesis = CreateGenesisBlock(1446058291, MAINNET_GENESIS_NONCE, 0x1f00ffff, 1, 400000000 * COIN, consensus); + genesis = CreateGenesisBlock(1446058291, MAINNET_GENESIS_NONCE, 0x1f00ffff, 1, 400000000 * COIN); consensus.hashGenesisBlock = genesis.GetHash(); #ifdef FIND_GENESIS std::cout << "hex: " << consensus.hashGenesisBlock.GetHex() << std::endl; @@ -241,7 +241,7 @@ public: nDefaultPort = 19246; nPruneAfterHeight = 1000; - genesis = CreateGenesisBlock(1446058291, TESTNET_GENESIS_NONCE, 0x1f00ffff, 1, 400000000 * COIN, consensus); + genesis = CreateGenesisBlock(1446058291, TESTNET_GENESIS_NONCE, 0x1f00ffff, 1, 400000000 * COIN); consensus.hashGenesisBlock = genesis.GetHash(); #ifdef FIND_GENESIS std::cout << "testnet genesis hash: " << genesis.GetHash().GetHex() << std::endl; @@ -319,7 +319,7 @@ public: nDefaultPort = 29246; nPruneAfterHeight = 1000; - genesis = CreateGenesisBlock(1446058291, REGTEST_GENESIS_NONCE, 0x207fffff, 1, 400000000 * COIN, consensus); + genesis = CreateGenesisBlock(1446058291, REGTEST_GENESIS_NONCE, 0x207fffff, 1, 400000000 * COIN); consensus.hashGenesisBlock = genesis.GetHash(); #ifdef FIND_GENESIS std::cout << "regtest genensis hash: " << genesis.GetHash().GetHex() << std::endl; -- 2.45.3