mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-06-02 15:32:34 +02:00
Qt/Options: When changing peerblockfilters, also set peercfilters for better downgrade compatibility
Only in bitcoin_rw.conf
This commit is contained in:
parent
7dce75e5f8
commit
857523fc33
@ -1023,7 +1023,7 @@ void ModifyRWConfigStream(std::istream& stream_in, std::ostream& stream_out, con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArgsManager::ModifyRWConfigFile(const std::map<std::string, std::string>& settings_to_change)
|
void ArgsManager::ModifyRWConfigFile(const std::map<std::string, std::string>& settings_to_change, const bool also_settings_json)
|
||||||
{
|
{
|
||||||
LOCK(cs_args);
|
LOCK(cs_args);
|
||||||
fs::path rwconf_path{GetRWConfigFilePath()};
|
fs::path rwconf_path{GetRWConfigFilePath()};
|
||||||
@ -1050,7 +1050,7 @@ void ArgsManager::ModifyRWConfigFile(const std::map<std::string, std::string>& s
|
|||||||
for (const auto& setting_change : settings_to_change) {
|
for (const auto& setting_change : settings_to_change) {
|
||||||
m_settings.rw_config[setting_change.first] = {setting_change.second};
|
m_settings.rw_config[setting_change.first] = {setting_change.second};
|
||||||
}
|
}
|
||||||
if (!IsArgNegated("-settings")) {
|
if (also_settings_json && !IsArgNegated("-settings")) {
|
||||||
// Also save to settings.json for Core (0.21+) compatibility
|
// Also save to settings.json for Core (0.21+) compatibility
|
||||||
for (const auto& setting_change : settings_to_change) {
|
for (const auto& setting_change : settings_to_change) {
|
||||||
m_settings.rw_settings[setting_change.first] = setting_change.second;
|
m_settings.rw_settings[setting_change.first] = setting_change.second;
|
||||||
@ -1062,11 +1062,11 @@ void ArgsManager::ModifyRWConfigFile(const std::map<std::string, std::string>& s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArgsManager::ModifyRWConfigFile(const std::string& setting_to_change, const std::string& new_value)
|
void ArgsManager::ModifyRWConfigFile(const std::string& setting_to_change, const std::string& new_value, const bool also_settings_json)
|
||||||
{
|
{
|
||||||
std::map<std::string, std::string> settings_to_change;
|
std::map<std::string, std::string> settings_to_change;
|
||||||
settings_to_change[setting_to_change] = new_value;
|
settings_to_change[setting_to_change] = new_value;
|
||||||
ModifyRWConfigFile(settings_to_change);
|
ModifyRWConfigFile(settings_to_change, also_settings_json);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArgsManager::EraseRWConfigFile()
|
void ArgsManager::EraseRWConfigFile()
|
||||||
|
@ -190,8 +190,8 @@ protected:
|
|||||||
[[nodiscard]] bool ReadConfigFiles(std::string& error, bool ignore_invalid_keys = false);
|
[[nodiscard]] bool ReadConfigFiles(std::string& error, bool ignore_invalid_keys = false);
|
||||||
|
|
||||||
bool RWConfigHasPruneOption() const { return m_rwconf_had_prune_option; }
|
bool RWConfigHasPruneOption() const { return m_rwconf_had_prune_option; }
|
||||||
void ModifyRWConfigFile(const std::map<std::string, std::string>& settings_to_change);
|
void ModifyRWConfigFile(const std::map<std::string, std::string>& settings_to_change, bool also_settings_json = true);
|
||||||
void ModifyRWConfigFile(const std::string& setting_to_change, const std::string& new_value);
|
void ModifyRWConfigFile(const std::string& setting_to_change, const std::string& new_value, bool also_settings_json = true);
|
||||||
void EraseRWConfigFile();
|
void EraseRWConfigFile();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -841,6 +841,7 @@ bool OptionsModel::setOption(OptionID option, const QVariant& value, const std::
|
|||||||
bool nv = value.toBool();
|
bool nv = value.toBool();
|
||||||
if (gArgs.GetBoolArg("-peerblockfilters", DEFAULT_PEERBLOCKFILTERS) != nv) {
|
if (gArgs.GetBoolArg("-peerblockfilters", DEFAULT_PEERBLOCKFILTERS) != nv) {
|
||||||
gArgs.ModifyRWConfigFile("peerblockfilters", strprintf("%d", nv));
|
gArgs.ModifyRWConfigFile("peerblockfilters", strprintf("%d", nv));
|
||||||
|
gArgs.ModifyRWConfigFile("peercfilters", strprintf("%d", nv), /*also_settings_json=*/ false); // for downgrade compatibility with Knots 0.19
|
||||||
gArgs.ForceSetArg("peerblockfilters", nv);
|
gArgs.ForceSetArg("peerblockfilters", nv);
|
||||||
if (nv && !GetBlockFilterIndex(BlockFilterType::BASIC)) {
|
if (nv && !GetBlockFilterIndex(BlockFilterType::BASIC)) {
|
||||||
// TODO: When other options are possible, we need to append a list!
|
// TODO: When other options are possible, we need to append a list!
|
||||||
|
Loading…
Reference in New Issue
Block a user