Always use parameters at block 0 to get genesis block hash (#1416)

This doesn't actually change behaviour, but stylistically is more correct.
This commit is contained in:
Ross Nicoll 2018-01-08 20:23:41 +00:00
parent 33db4921e5
commit 493f02ba2a

View file

@ -1782,7 +1782,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
// Special case for the genesis block, skipping connection of its transactions
// (its coinbase is unspendable)
if (block.GetHash() == consensus.hashGenesisBlock) {
if (block.GetHash() == Params().GetConsensus(0).hashGenesisBlock) {
if (!fJustCheck)
view.SetBestBlock(pindex->GetBlockHash());
return true;
@ -2934,7 +2934,7 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
static bool CheckIndexAgainstCheckpoint(const CBlockIndex* pindexPrev, CValidationState& state, const CChainParams& chainparams, const uint256& hash)
{
if (*pindexPrev->phashBlock == chainparams.GetConsensus(pindexPrev->nHeight + 1).hashGenesisBlock)
if (*pindexPrev->phashBlock == chainparams.GetConsensus(0).hashGenesisBlock)
return true;
int nHeight = pindexPrev->nHeight+1;