aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-07-14 17:20:47 +0200
committerMacroFake <falke.marco@gmail.com>2022-07-14 17:20:55 +0200
commit02ede4f1fde9b5aa3ff370d523f9c9858c98905c (patch)
tree6361f1ff8b0256cc2d94b7b1f73c02fae491788a /src
parent062b9db0ccb6af8bfbaa2b29132408cda9991b40 (diff)
parentce8b0f971b94e68db1e902dbd20dd99dcf9bcb0a (diff)
Merge bitcoin/bitcoin#25607: [kernel 3d/n] Misc `ChainstateManager::Options` fixups
ce8b0f971b94e68db1e902dbd20dd99dcf9bcb0a Use designated initializers for ChainstateManager::Options (Carl Dong) 38377002671d038aadb01e1521ea95c97838cedc Move ChainstateManagerOpts into kernel:: namespace (Carl Dong) Pull request description: This is part of the `libbitcoinkernel` project: #24303, https://github.com/bitcoin/bitcoin/projects/18 This PR is **_NOT_** dependent on any other PRs. ----- Places `ChainstateManager::Options` into the `kernel::` namespace and use designated initializers for construction. ACKs for top commit: ryanofsky: Code review ACK ce8b0f971b94e68db1e902dbd20dd99dcf9bcb0a Tree-SHA512: 16a11b5051a2432ca4b6fa7b253376606fef619ace499dfe64d033c8fbe3e1a1875a7c946d7cd54bd908363886244ddf3a192e2f0c801ffbed40d60aad65e442
Diffstat (limited to 'src')
-rw-r--r--src/bitcoin-chainstate.cpp4
-rw-r--r--src/init.cpp4
-rw-r--r--src/kernel/chainstatemanager_opts.h4
-rw-r--r--src/test/util/setup_common.cpp4
-rw-r--r--src/test/validation_chainstate_tests.cpp4
-rw-r--r--src/validation.h2
6 files changed, 13 insertions, 9 deletions
diff --git a/src/bitcoin-chainstate.cpp b/src/bitcoin-chainstate.cpp
index 1817aa1a53..d53e917aba 100644
--- a/src/bitcoin-chainstate.cpp
+++ b/src/bitcoin-chainstate.cpp
@@ -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};
diff --git a/src/init.cpp b/src/init.cpp
index 816404a84f..267070a4c9 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -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;
diff --git a/src/kernel/chainstatemanager_opts.h b/src/kernel/chainstatemanager_opts.h
index 575d94e2e9..510a1f9edc 100644
--- a/src/kernel/chainstatemanager_opts.h
+++ b/src/kernel/chainstatemanager_opts.h
@@ -10,6 +10,8 @@
class CChainParams;
+namespace kernel {
+
/**
* An options struct for `ChainstateManager`, more ergonomically referred to as
* `ChainstateManager::Options` due to the using-declaration in
@@ -20,4 +22,6 @@ struct ChainstateManagerOpts {
const std::function<int64_t()> adjusted_time_callback{nullptr};
};
+} // namespace kernel
+
#endif // BITCOIN_KERNEL_CHAINSTATEMANAGER_OPTS_H
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp
index de53499088..0fba9258f1 100644
--- a/src/test/util/setup_common.cpp
+++ b/src/test/util/setup_common.cpp
@@ -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);
diff --git a/src/test/validation_chainstate_tests.cpp b/src/test/validation_chainstate_tests.cpp
index 102de74389..78adb521ac 100644
--- a/src/test/validation_chainstate_tests.cpp
+++ b/src/test/validation_chainstate_tests.cpp
@@ -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};
diff --git a/src/validation.h b/src/validation.h
index 0e27e117fa..aa9fcf9f2d 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -834,7 +834,7 @@ private:
friend CChainState;
public:
- using Options = ChainstateManagerOpts;
+ using Options = kernel::ChainstateManagerOpts;
explicit ChainstateManager(const Options& opts)
: m_chainparams{opts.chainparams},