mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
validation: Use existing chain member in CChainState::LoadGenesisBlock
This commit is contained in:
parent
5e4af77380
commit
03f75c42e1
1 changed files with 2 additions and 1 deletions
|
@ -4629,9 +4629,10 @@ bool CChainState::LoadGenesisBlock(const CChainParams& chainparams)
|
||||||
if (m_blockman.m_block_index.count(chainparams.GenesisBlock().GetHash()))
|
if (m_blockman.m_block_index.count(chainparams.GenesisBlock().GetHash()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
assert(std::addressof(::ChainActive()) == std::addressof(m_chain));
|
||||||
try {
|
try {
|
||||||
const CBlock& block = chainparams.GenesisBlock();
|
const CBlock& block = chainparams.GenesisBlock();
|
||||||
FlatFilePos blockPos = SaveBlockToDisk(block, 0, ::ChainActive(), chainparams, nullptr);
|
FlatFilePos blockPos = SaveBlockToDisk(block, 0, m_chain, chainparams, nullptr);
|
||||||
if (blockPos.IsNull())
|
if (blockPos.IsNull())
|
||||||
return error("%s: writing genesis block to disk failed", __func__);
|
return error("%s: writing genesis block to disk failed", __func__);
|
||||||
CBlockIndex *pindex = m_blockman.AddToBlockIndex(block);
|
CBlockIndex *pindex = m_blockman.AddToBlockIndex(block);
|
||||||
|
|
Loading…
Add table
Reference in a new issue