mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Add BlockManagerOpts::chainparams reference
and use it in blockstorage.cpp
This commit is contained in:
@@ -255,7 +255,7 @@ CBlockIndex* BlockManager::InsertBlockIndex(const uint256& hash)
|
||||
|
||||
bool BlockManager::LoadBlockIndex(const Consensus::Params& consensus_params)
|
||||
{
|
||||
if (!m_block_tree_db->LoadBlockIndexGuts(consensus_params, [this](const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { return this->InsertBlockIndex(hash); })) {
|
||||
if (!m_block_tree_db->LoadBlockIndexGuts(GetConsensus(), [this](const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main) { return this->InsertBlockIndex(hash); })) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -729,7 +729,7 @@ bool BlockManager::WriteUndoDataForBlock(const CBlockUndo& blockundo, BlockValid
|
||||
if (!FindUndoPos(state, pindex->nFile, _pos, ::GetSerializeSize(blockundo, CLIENT_VERSION) + 40)) {
|
||||
return error("ConnectBlock(): FindUndoPos failed");
|
||||
}
|
||||
if (!UndoWriteToDisk(blockundo, _pos, pindex->pprev->GetBlockHash(), chainparams.MessageStart())) {
|
||||
if (!UndoWriteToDisk(blockundo, _pos, pindex->pprev->GetBlockHash(), GetParams().MessageStart())) {
|
||||
return AbortNode(state, "Failed to write undo data");
|
||||
}
|
||||
// rev files are written in block height order, whereas blk files are written as blocks come in (often out of order)
|
||||
@@ -847,7 +847,7 @@ FlatFilePos BlockManager::SaveBlockToDisk(const CBlock& block, int nHeight, CCha
|
||||
return FlatFilePos();
|
||||
}
|
||||
if (!position_known) {
|
||||
if (!WriteBlockToDisk(block, blockPos, chainparams.MessageStart())) {
|
||||
if (!WriteBlockToDisk(block, blockPos, GetParams().MessageStart())) {
|
||||
AbortNode("Failed to write block");
|
||||
return FlatFilePos();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user