Skip to content

Commit faf012b

Browse files
author
MacroFake
committed
Do not pass Consensus::Params& to Chainstate helpers
1 parent fa4ee53 commit faf012b

File tree

5 files changed

+3
-13
lines changed

5 files changed

+3
-13
lines changed

src/bitcoin-chainstate.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ int main(int argc, char* argv[])
7676
std::ref(chainman),
7777
nullptr,
7878
false,
79-
chainparams.GetConsensus(),
8079
false,
8180
2 << 20,
8281
2 << 22,
@@ -91,7 +90,6 @@ int main(int argc, char* argv[])
9190
auto maybe_verify_error = node::VerifyLoadedChainstate(std::ref(chainman),
9291
false,
9392
false,
94-
chainparams.GetConsensus(),
9593
DEFAULT_CHECKBLOCKS,
9694
DEFAULT_CHECKLEVEL);
9795
if (maybe_verify_error.has_value()) {

src/init.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
14381438
chainman,
14391439
Assert(node.mempool.get()),
14401440
fPruneMode,
1441-
chainparams.GetConsensus(),
14421441
fReindexChainState,
14431442
cache_sizes.block_tree_db,
14441443
cache_sizes.coins_db,
@@ -1485,7 +1484,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
14851484
break;
14861485
case ChainstateLoadingError::ERROR_BLOCKS_WITNESS_INSUFFICIENTLY_VALIDATED:
14871486
strLoadError = strprintf(_("Witness data for blocks after height %d requires validation. Please restart with -reindex."),
1488-
chainparams.GetConsensus().SegwitHeight);
1487+
chainman.GetConsensus().SegwitHeight);
14891488
break;
14901489
case ChainstateLoadingError::SHUTDOWN_PROBED:
14911490
break;
@@ -1502,7 +1501,6 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
15021501
maybe_verify_error = VerifyLoadedChainstate(chainman,
15031502
fReset,
15041503
fReindexChainState,
1505-
chainparams.GetConsensus(),
15061504
check_blocks,
15071505
args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL));
15081506
} catch (const std::exception& e) {

src/node/chainstate.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
1313
ChainstateManager& chainman,
1414
CTxMemPool* mempool,
1515
bool fPruneMode,
16-
const Consensus::Params& consensus_params,
1716
bool fReindexChainState,
1817
int64_t nBlockTreeDBCache,
1918
int64_t nCoinDBCache,
@@ -57,7 +56,7 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
5756
}
5857

5958
if (!chainman.BlockIndex().empty() &&
60-
!chainman.m_blockman.LookupBlockIndex(consensus_params.hashGenesisBlock)) {
59+
!chainman.m_blockman.LookupBlockIndex(chainman.GetConsensus().hashGenesisBlock)) {
6160
return ChainstateLoadingError::ERROR_BAD_GENESIS_BLOCK;
6261
}
6362

@@ -126,7 +125,6 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
126125
std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManager& chainman,
127126
bool fReset,
128127
bool fReindexChainState,
129-
const Consensus::Params& consensus_params,
130128
int check_blocks,
131129
int check_level)
132130
{
@@ -144,7 +142,7 @@ std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManage
144142
}
145143

146144
if (!CVerifyDB().VerifyDB(
147-
*chainstate, consensus_params, chainstate->CoinsDB(),
145+
*chainstate, chainman.GetConsensus(), chainstate->CoinsDB(),
148146
check_level,
149147
check_blocks)) {
150148
return ChainstateLoadVerifyError::ERROR_CORRUPTED_BLOCK_DB;

src/node/chainstate.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
5959
ChainstateManager& chainman,
6060
CTxMemPool* mempool,
6161
bool fPruneMode,
62-
const Consensus::Params& consensus_params,
6362
bool fReindexChainState,
6463
int64_t nBlockTreeDBCache,
6564
int64_t nCoinDBCache,
@@ -78,7 +77,6 @@ enum class ChainstateLoadVerifyError {
7877
std::optional<ChainstateLoadVerifyError> VerifyLoadedChainstate(ChainstateManager& chainman,
7978
bool fReset,
8079
bool fReindexChainState,
81-
const Consensus::Params& consensus_params,
8280
int check_blocks,
8381
int check_level);
8482
} // namespace node

src/test/util/setup_common.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
201201
*Assert(m_node.chainman.get()),
202202
Assert(m_node.mempool.get()),
203203
fPruneMode,
204-
chainparams.GetConsensus(),
205204
m_args.GetBoolArg("-reindex-chainstate", false),
206205
m_cache_sizes.block_tree_db,
207206
m_cache_sizes.coins_db,
@@ -214,7 +213,6 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
214213
*Assert(m_node.chainman),
215214
fReindex.load(),
216215
m_args.GetBoolArg("-reindex-chainstate", false),
217-
chainparams.GetConsensus(),
218216
m_args.GetIntArg("-checkblocks", DEFAULT_CHECKBLOCKS),
219217
m_args.GetIntArg("-checklevel", DEFAULT_CHECKLEVEL));
220218
assert(!maybe_verify_error.has_value());

0 commit comments

Comments
 (0)