From 6bb56092b8ca170cdf475c69699f2fa9e5ccd4ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Tim=C3=B3n?= Date: Fri, 3 Jul 2015 16:11:06 +0200 Subject: [PATCH] Testchains: Don't check the genesis block Rebased by Pieter Wuille. Cleanup by Matt Corallo. --- src/pow.cpp | 3 +++ src/txdb.cpp | 2 +- src/txdb.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pow.cpp b/src/pow.cpp index 1db3b69293..6df9d71d40 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -80,6 +80,9 @@ bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params& bool fOverflow; arith_uint256 bnTarget; + if (hash == params.hashGenesisBlock) + return true; + bnTarget.SetCompact(nBits, &fNegative, &fOverflow); // Check range diff --git a/src/txdb.cpp b/src/txdb.cpp index 078c29def3..c34e5ee0e4 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -199,7 +199,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts(boost::functionnStatus = diskindex.nStatus; pindexNew->nTx = diskindex.nTx; - if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, Params().GetConsensus())) + if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, consensusParams)) return error("LoadBlockIndex(): CheckProofOfWork failed: %s", pindexNew->ToString()); pcursor->Next(); diff --git a/src/txdb.h b/src/txdb.h index 5b98d2792c..3f11ce6a36 100644 --- a/src/txdb.h +++ b/src/txdb.h @@ -20,6 +20,7 @@ class CBlockIndex; class CCoinsViewDBCursor; class uint256; +namespace Consensus { struct Params; } //! -dbcache default (MiB) static const int64_t nDefaultDbCache = 300;