@@ -737,31 +737,31 @@ fs::path GetConfigFile(const std::string& confPath)
737
737
738
738
void ArgsManager::ReadConfigStream (std::istream& stream)
739
739
{
740
- if (!stream.good ())
741
- return ; // No bitcoin.conf file is OK
740
+ LOCK (cs_args);
742
741
743
- {
744
- LOCK (cs_args);
745
- std::set<std::string> setOptions;
746
- setOptions.insert (" *" );
742
+ std::set<std::string> setOptions;
743
+ setOptions.insert (" *" );
747
744
748
- for (boost::program_options::detail::config_file_iterator it (stream, setOptions), end; it != end; ++it)
749
- {
750
- // Don't overwrite existing settings so command line settings override bitcoin.conf
751
- std::string strKey = std::string (" -" ) + it->string_key ;
752
- std::string strValue = it->value [0 ];
753
- InterpretNegatedOption (strKey, strValue);
754
- if (mapArgs.count (strKey) == 0 )
755
- mapArgs[strKey] = strValue;
756
- mapMultiArgs[strKey].push_back (strValue);
757
- }
745
+ for (boost::program_options::detail::config_file_iterator it (stream, setOptions), end; it != end; ++it)
746
+ {
747
+ // Don't overwrite existing settings so command line settings override bitcoin.conf
748
+ std::string strKey = std::string (" -" ) + it->string_key ;
749
+ std::string strValue = it->value [0 ];
750
+ InterpretNegatedOption (strKey, strValue);
751
+ if (mapArgs.count (strKey) == 0 )
752
+ mapArgs[strKey] = strValue;
753
+ mapMultiArgs[strKey].push_back (strValue);
758
754
}
759
755
}
760
756
761
757
void ArgsManager::ReadConfigFile (const std::string& confPath)
762
758
{
763
759
fs::ifstream stream (GetConfigFile (confPath));
764
- ReadConfigStream (stream);
760
+
761
+ // ok to not have a config file
762
+ if (stream.good ()) {
763
+ ReadConfigStream (stream);
764
+ }
765
765
766
766
// If datadir is changed in .conf file:
767
767
ClearDatadirCache ();
0 commit comments