0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-05 14:06:27 -05:00

validation: replace ::Params() calls with chainstate/chainman member

This commit is contained in:
Anthony Towns 2022-04-15 05:41:19 +10:00
parent 38860f93b6
commit 5c67e84d37
2 changed files with 5 additions and 4 deletions

View file

@ -1457,7 +1457,7 @@ PackageMempoolAcceptResult ProcessNewPackage(CChainState& active_chainstate, CTx
assert(std::all_of(package.cbegin(), package.cend(), [](const auto& tx){return tx != nullptr;})); assert(std::all_of(package.cbegin(), package.cend(), [](const auto& tx){return tx != nullptr;}));
std::vector<COutPoint> coins_to_uncache; std::vector<COutPoint> coins_to_uncache;
const CChainParams& chainparams = Params(); const CChainParams& chainparams = active_chainstate.m_params;
const auto result = [&]() EXCLUSIVE_LOCKS_REQUIRED(cs_main) { const auto result = [&]() EXCLUSIVE_LOCKS_REQUIRED(cs_main) {
AssertLockHeld(cs_main); AssertLockHeld(cs_main);
if (test_accept) { if (test_accept) {
@ -1515,7 +1515,7 @@ CChainState::CChainState(
std::optional<uint256> from_snapshot_blockhash) std::optional<uint256> from_snapshot_blockhash)
: m_mempool(mempool), : m_mempool(mempool),
m_blockman(blockman), m_blockman(blockman),
m_params(::Params()), m_params(chainman.GetParams()),
m_chainman(chainman), m_chainman(chainman),
m_from_snapshot_blockhash(from_snapshot_blockhash) {} m_from_snapshot_blockhash(from_snapshot_blockhash) {}
@ -4993,7 +4993,7 @@ bool ChainstateManager::PopulateAndValidateSnapshot(
} }
int base_height = snapshot_start_block->nHeight; int base_height = snapshot_start_block->nHeight;
auto maybe_au_data = ExpectedAssumeutxo(base_height, ::Params()); auto maybe_au_data = ExpectedAssumeutxo(base_height, GetParams());
if (!maybe_au_data) { if (!maybe_au_data) {
LogPrintf("[snapshot] assumeutxo height in snapshot metadata not recognized " /* Continued */ LogPrintf("[snapshot] assumeutxo height in snapshot metadata not recognized " /* Continued */
@ -5147,7 +5147,7 @@ bool ChainstateManager::PopulateAndValidateSnapshot(
// Fake BLOCK_OPT_WITNESS so that CChainState::NeedsRedownload() // Fake BLOCK_OPT_WITNESS so that CChainState::NeedsRedownload()
// won't ask to rewind the entire assumed-valid chain on startup. // won't ask to rewind the entire assumed-valid chain on startup.
if (DeploymentActiveAt(*index, ::Params().GetConsensus(), Consensus::DEPLOYMENT_SEGWIT)) { if (DeploymentActiveAt(*index, GetConsensus(), Consensus::DEPLOYMENT_SEGWIT)) {
index->nStatus |= BLOCK_OPT_WITNESS; index->nStatus |= BLOCK_OPT_WITNESS;
} }

View file

@ -498,6 +498,7 @@ public:
node::BlockManager& m_blockman; node::BlockManager& m_blockman;
/** Chain parameters for this chainstate */ /** Chain parameters for this chainstate */
/* TODO: replace with m_chainman.GetParams() */
const CChainParams& m_params; const CChainParams& m_params;
//! The chainstate manager that owns this chainstate. The reference is //! The chainstate manager that owns this chainstate. The reference is