@@ -871,8 +871,10 @@ bool ArgsManager::ReadConfigStream(std::istream& stream, std::string& error, boo
871
871
872
872
bool ArgsManager::ReadConfigFiles (std::string& error, bool ignore_invalid_keys)
873
873
{
874
- LOCK (cs_args);
875
- m_config_args.clear ();
874
+ {
875
+ LOCK (cs_args);
876
+ m_config_args.clear ();
877
+ }
876
878
877
879
const std::string confPath = GetArg (" -conf" , BITCOIN_CONF_FILENAME);
878
880
fs::ifstream stream (GetConfigFile (confPath));
@@ -884,7 +886,12 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
884
886
}
885
887
// if there is an -includeconf in the override args, but it is empty, that means the user
886
888
// passed '-noincludeconf' on the command line, in which case we should not include anything
887
- if (m_override_args.count (" -includeconf" ) == 0 ) {
889
+ bool emptyIncludeConf;
890
+ {
891
+ LOCK (cs_args);
892
+ emptyIncludeConf = m_override_args.count (" -includeconf" ) == 0 ;
893
+ }
894
+ if (emptyIncludeConf) {
888
895
std::string chain_id = GetChainName ();
889
896
std::vector<std::string> includeconf (GetArgs (" -includeconf" ));
890
897
{
@@ -896,8 +903,11 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
896
903
897
904
// Remove -includeconf from configuration, so we can warn about recursion
898
905
// later
899
- m_config_args.erase (" -includeconf" );
900
- m_config_args.erase (std::string (" -" ) + chain_id + " .includeconf" );
906
+ {
907
+ LOCK (cs_args);
908
+ m_config_args.erase (" -includeconf" );
909
+ m_config_args.erase (std::string (" -" ) + chain_id + " .includeconf" );
910
+ }
901
911
902
912
for (const std::string& to_include : includeconf) {
903
913
fs::ifstream include_config (GetConfigFile (to_include));
0 commit comments