aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2022-06-01 19:10:10 +0000
committerCory Fields <cory-nospam-@coryfields.com>2022-06-02 15:18:09 +0000
commita4741bd8d4b90b451d982d98eabd0dc5572baa29 (patch)
tree5f92d4bb4d9a8423bd679a2dcd8a62cb012f931a /src
parent1c7ef0abd11f35a27cc860ceb7e075b78f53cecf (diff)
downloadbitcoin-a4741bd8d4b90b451d982d98eabd0dc5572baa29.tar.xz
kernel: pass params to BlockManager rather than using a global
Diffstat (limited to 'src')
-rw-r--r--src/node/blockstorage.cpp4
-rw-r--r--src/node/blockstorage.h2
-rw-r--r--src/validation.cpp2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp
index 17ab226a30..9112ce3bf3 100644
--- a/src/node/blockstorage.cpp
+++ b/src/node/blockstorage.cpp
@@ -318,9 +318,9 @@ bool BlockManager::WriteBlockIndexDB()
return true;
}
-bool BlockManager::LoadBlockIndexDB()
+bool BlockManager::LoadBlockIndexDB(const Consensus::Params& consensus_params)
{
- if (!LoadBlockIndex(::Params().GetConsensus())) {
+ if (!LoadBlockIndex(consensus_params)) {
return false;
}
diff --git a/src/node/blockstorage.h b/src/node/blockstorage.h
index 488713dbd8..2e52716649 100644
--- a/src/node/blockstorage.h
+++ b/src/node/blockstorage.h
@@ -153,7 +153,7 @@ public:
std::unique_ptr<CBlockTreeDB> m_block_tree_db GUARDED_BY(::cs_main);
bool WriteBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
- bool LoadBlockIndexDB() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
+ bool LoadBlockIndexDB(const Consensus::Params& consensus_params) EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
CBlockIndex* AddToBlockIndex(const CBlockHeader& block, CBlockIndex*& best_header) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
/** Create a new block index entry for a given block hash */
diff --git a/src/validation.cpp b/src/validation.cpp
index 9ad95c1c08..448720ff83 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -4158,7 +4158,7 @@ bool ChainstateManager::LoadBlockIndex()
// Load block index from databases
bool needs_init = fReindex;
if (!fReindex) {
- bool ret = m_blockman.LoadBlockIndexDB();
+ bool ret = m_blockman.LoadBlockIndexDB(GetConsensus());
if (!ret) return false;
std::vector<CBlockIndex*> vSortedByHeight{m_blockman.GetAllBlockIndices()};