Skip to content

Commit 92b5f03

Browse files
committed
use *CACHE constants from bitcoin core
bitcoin/bitcoin#31483
1 parent 1140537 commit 92b5f03

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

qml/models/options_model.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <common/settings.h>
99
#include <common/system.h>
1010
#include <interfaces/node.h>
11+
#include <node/caches.h>
1112
#include <mapport.h>
1213
#include <qt/guiconstants.h>
1314
#include <qt/guiutil.h>
@@ -28,7 +29,7 @@ OptionsQmlModel::OptionsQmlModel(interfaces::Node& node, bool is_onboarded)
2829
: m_node{node}
2930
, m_onboarded{is_onboarded}
3031
{
31-
m_dbcache_size_mib = SettingToInt(m_node.getPersistentSetting("dbcache"), nDefaultDbCache);
32+
m_dbcache_size_mib = SettingToInt(m_node.getPersistentSetting("dbcache"), DEFAULT_DB_CACHE >> 20);
3233

3334
m_listen = SettingToBool(m_node.getPersistentSetting("listen"), DEFAULT_LISTEN);
3435

@@ -204,7 +205,7 @@ void OptionsQmlModel::setDataDir(QString new_data_dir)
204205
void OptionsQmlModel::onboard()
205206
{
206207
m_node.resetSettings();
207-
if (m_dbcache_size_mib != nDefaultDbCache) {
208+
if (m_dbcache_size_mib != DEFAULT_DB_CACHE >> 20) {
208209
m_node.updateRwSetting("dbcache", m_dbcache_size_mib);
209210
}
210211
if (m_listen) {

qml/models/options_model.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#include <txdb.h>
99
#include <common/settings.h>
10+
#include <node/caches.h>
11+
#include <kernel/caches.h>
1012
#include <common/system.h>
1113
#include <validation.h>
1214

@@ -92,8 +94,8 @@ public Q_SLOTS:
9294

9395
// Properties that are exposed to QML.
9496
int m_dbcache_size_mib;
95-
const int m_min_dbcache_size_mib{nMinDbCache};
96-
const int m_max_dbcache_size_mib{nMaxDbCache};
97+
const int m_min_dbcache_size_mib{MIN_DB_CACHE >> 20};
98+
const int m_max_dbcache_size_mib{MAX_COINS_DB_CACHE >> 20};
9799
bool m_listen;
98100
const int m_max_script_threads{MAX_SCRIPTCHECK_THREADS};
99101
const int m_min_script_threads{-GetNumCores()};

0 commit comments

Comments
 (0)