File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed
Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 1212#include < algorithm>
1313#include < string>
1414
15+ // Unlike for the UTXO database, for the txindex scenario the leveldb cache make
16+ // a meaningful difference: https://github.com/bitcoin/bitcoin/pull/8273#issuecomment-229601991
17+ // ! Max memory allocated to tx index DB specific cache in MiB.
18+ static constexpr int64_t MAX_TX_INDEX_CACHE{1024 };
19+ // ! Max memory allocated to all block filter index caches combined in MiB.
20+ static constexpr int64_t MAX_FILTER_INDEX_CACHE{1024 };
21+
1522namespace node {
1623CacheSizes CalculateCacheSizes (const ArgsManager& args, size_t n_indexes)
1724{
1825 int64_t nTotalCache = (args.GetIntArg (" -dbcache" , nDefaultDbCache) << 20 );
1926 nTotalCache = std::max (nTotalCache, nMinDbCache << 20 ); // total cache cannot be less than nMinDbCache
2027 IndexCacheSizes sizes;
21- sizes.tx_index = std::min (nTotalCache / 8 , args.GetBoolArg (" -txindex" , DEFAULT_TXINDEX) ? nMaxTxIndexCache << 20 : 0 );
28+ sizes.tx_index = std::min (nTotalCache / 8 , args.GetBoolArg (" -txindex" , DEFAULT_TXINDEX) ? MAX_TX_INDEX_CACHE << 20 : 0 );
2229 nTotalCache -= sizes.tx_index ;
2330 if (n_indexes > 0 ) {
24- int64_t max_cache = std::min (nTotalCache / 8 , max_filter_index_cache << 20 );
31+ int64_t max_cache = std::min (nTotalCache / 8 , MAX_FILTER_INDEX_CACHE << 20 );
2532 sizes.filter_index = max_cache / n_indexes;
2633 nTotalCache -= sizes.filter_index * n_indexes;
2734 }
Original file line number Diff line number Diff line change 88#include < kernel/caches.h>
99
1010#include < cstddef>
11- #include < cstdint>
1211
1312class ArgsManager ;
1413
1514namespace node {
1615struct IndexCacheSizes {
17- int64_t tx_index{0 };
18- int64_t filter_index{0 };
16+ size_t tx_index{0 };
17+ size_t filter_index{0 };
1918};
2019struct CacheSizes {
2120 IndexCacheSizes index;
Original file line number Diff line number Diff line change @@ -27,12 +27,6 @@ static const int64_t nDefaultDbCache = 450;
2727static const int64_t nDefaultDbBatchSize = 16 << 20 ;
2828// ! min. -dbcache (MiB)
2929static const int64_t nMinDbCache = 4 ;
30- // Unlike for the UTXO database, for the txindex scenario the leveldb cache make
31- // a meaningful difference: https://github.com/bitcoin/bitcoin/pull/8273#issuecomment-229601991
32- // ! Max memory allocated to tx index DB specific cache in MiB.
33- static const int64_t nMaxTxIndexCache = 1024 ;
34- // ! Max memory allocated to all block filter index caches combined in MiB.
35- static const int64_t max_filter_index_cache = 1024 ;
3630
3731// ! User-controlled performance and debug options.
3832struct CoinsViewOptions {
You can’t perform that action at this time.
0 commit comments