Skip to content

Commit

Permalink
kernel: Prefer contrived names over tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
hodlinator committed Dec 21, 2024
1 parent b98b047 commit 196269a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/node/caches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static constexpr int64_t MAX_FILTER_INDEX_CACHE{1024};
using kernel::MiBToBytes;

namespace node {
std::tuple<IndexCacheSizes, kernel::CacheSizes> CalculateCacheSizes(const ArgsManager& args, size_t n_indexes)
IndexAndKernelCacheSizes CalculateCacheSizes(const ArgsManager& args, size_t n_indexes)
{
size_t nTotalCache{MiBToBytes(args.GetIntArg("-dbcache", DEFAULT_DB_CACHE))};
nTotalCache = std::max(nTotalCache, MiBToBytes(MIN_DB_CACHE));
Expand Down
6 changes: 5 additions & 1 deletion src/node/caches.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ struct IndexCacheSizes {
size_t tx_index;
size_t filter_index;
};
std::tuple<IndexCacheSizes, kernel::CacheSizes> CalculateCacheSizes(const ArgsManager& args, size_t n_indexes = 0);
struct IndexAndKernelCacheSizes {
IndexCacheSizes index;
kernel::CacheSizes kernel;
};
IndexAndKernelCacheSizes CalculateCacheSizes(const ArgsManager& args, size_t n_indexes = 0);
} // namespace node

#endif // BITCOIN_NODE_CACHES_H
2 changes: 1 addition & 1 deletion src/test/util/setup_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ struct BasicTestingSetup {
* initialization behaviour.
*/
struct ChainTestingSetup : public BasicTestingSetup {
kernel::CacheSizes m_kernel_cache_sizes{std::get<1>(node::CalculateCacheSizes(m_args))};
kernel::CacheSizes m_kernel_cache_sizes{node::CalculateCacheSizes(m_args).kernel};
bool m_coins_db_in_memory{true};
bool m_block_tree_db_in_memory{true};
std::function<void()> m_make_chainman{};
Expand Down

0 comments on commit 196269a

Please sign in to comment.