Skip to content

Commit 6bb5609

Browse files
jtimoninstagibbs
authored andcommitted
Testchains: Don't check the genesis block
Rebased by Pieter Wuille. Cleanup by Matt Corallo.
1 parent 20a84b8 commit 6bb5609

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

src/pow.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params&
8080
bool fOverflow;
8181
arith_uint256 bnTarget;
8282

83+
if (hash == params.hashGenesisBlock)
84+
return true;
85+
8386
bnTarget.SetCompact(nBits, &fNegative, &fOverflow);
8487

8588
// Check range

src/txdb.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts(boost::function<CBlockIndex*(const uint256
199199
pindexNew->nStatus = diskindex.nStatus;
200200
pindexNew->nTx = diskindex.nTx;
201201

202-
if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, Params().GetConsensus()))
202+
if (!CheckProofOfWork(pindexNew->GetBlockHash(), pindexNew->nBits, consensusParams))
203203
return error("LoadBlockIndex(): CheckProofOfWork failed: %s", pindexNew->ToString());
204204

205205
pcursor->Next();

src/txdb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
class CBlockIndex;
2121
class CCoinsViewDBCursor;
2222
class uint256;
23+
namespace Consensus { struct Params; }
2324

2425
//! -dbcache default (MiB)
2526
static const int64_t nDefaultDbCache = 300;

0 commit comments

Comments
 (0)