Use designated initializers for ChainstateManager::Options

This wasn't available at the time when ChainstateManager::Options was
introduced but is helpful to be explicit and ensure correctness.
This commit is contained in:
Carl Dong 2022-07-13 14:16:15 -04:00
parent 3837700267
commit ce8b0f971b
4 changed files with 8 additions and 8 deletions

View file

@ -78,8 +78,8 @@ int main(int argc, char* argv[])
// SETUP: Chainstate
const ChainstateManager::Options chainman_opts{
chainparams,
static_cast<int64_t(*)()>(GetTime),
.chainparams = chainparams,
.adjusted_time_callback = static_cast<int64_t (*)()>(GetTime),
};
ChainstateManager chainman{chainman_opts};

View file

@ -1440,8 +1440,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
node.mempool = std::make_unique<CTxMemPool>(mempool_opts);
const ChainstateManager::Options chainman_opts{
chainparams,
GetAdjustedTime,
.chainparams = chainparams,
.adjusted_time_callback = GetAdjustedTime,
};
node.chainman = std::make_unique<ChainstateManager>(chainman_opts);
ChainstateManager& chainman = *node.chainman;

View file

@ -183,8 +183,8 @@ ChainTestingSetup::ChainTestingSetup(const std::string& chainName, const std::ve
m_cache_sizes = CalculateCacheSizes(m_args);
const ChainstateManager::Options chainman_opts{
chainparams,
GetAdjustedTime,
.chainparams = chainparams,
.adjusted_time_callback = GetAdjustedTime,
};
m_node.chainman = std::make_unique<ChainstateManager>(chainman_opts);
m_node.chainman->m_blockman.m_block_tree_db = std::make_unique<CBlockTreeDB>(m_cache_sizes.block_tree_db, true);

View file

@ -24,8 +24,8 @@ BOOST_FIXTURE_TEST_SUITE(validation_chainstate_tests, TestingSetup)
BOOST_AUTO_TEST_CASE(validation_chainstate_resize_caches)
{
const ChainstateManager::Options chainman_opts{
Params(),
GetAdjustedTime,
.chainparams = Params(),
.adjusted_time_callback = GetAdjustedTime,
};
ChainstateManager manager{chainman_opts};