aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/spanparsing.cpp6
-rw-r--r--src/util/system.cpp26
-rw-r--r--src/util/system.h4
3 files changed, 22 insertions, 14 deletions
diff --git a/src/util/spanparsing.cpp b/src/util/spanparsing.cpp
index 0f68254f2c..e2e2782bec 100644
--- a/src/util/spanparsing.cpp
+++ b/src/util/spanparsing.cpp
@@ -34,11 +34,11 @@ Span<const char> Expr(Span<const char>& sp)
int level = 0;
auto it = sp.begin();
while (it != sp.end()) {
- if (*it == '(') {
+ if (*it == '(' || *it == '{') {
++level;
- } else if (level && *it == ')') {
+ } else if (level && (*it == ')' || *it == '}')) {
--level;
- } else if (level == 0 && (*it == ')' || *it == ',')) {
+ } else if (level == 0 && (*it == ')' || *it == '}' || *it == ',')) {
break;
}
++it;
diff --git a/src/util/system.cpp b/src/util/system.cpp
index 5b87806a45..258ba2f235 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -6,6 +6,11 @@
#include <util/system.h>
#ifdef ENABLE_EXTERNAL_SIGNER
+#if defined(WIN32) && !defined(__kernel_entry)
+// A workaround for boost 1.71 incompatibility with mingw-w64 compiler.
+// For details see https://github.com/bitcoin/bitcoin/pull/22348.
+#define __kernel_entry
+#endif
#include <boost/process.hpp>
#endif // ENABLE_EXTERNAL_SIGNER
@@ -365,11 +370,14 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin
m_settings.command_line_options[key].push_back(value);
}
- // we do not allow -includeconf from command line
+ // we do not allow -includeconf from command line, only -noincludeconf
if (auto* includes = util::FindKey(m_settings.command_line_options, "includeconf")) {
- const auto& include{*util::SettingsSpan(*includes).begin()}; // pick first value as example
- error = "-includeconf cannot be used from commandline; -includeconf=" + include.write();
- return false;
+ const util::SettingsSpan values{*includes};
+ // Range may be empty if -noincludeconf was passed
+ if (!values.empty()) {
+ error = "-includeconf cannot be used from commandline; -includeconf=" + values.begin()->write();
+ return false; // pick first value as example
+ }
}
return true;
}
@@ -617,14 +625,14 @@ void ArgsManager::ForceSetArg(const std::string& strArg, const std::string& strV
m_settings.forced_settings[SettingName(strArg)] = strValue;
}
-void ArgsManager::AddCommand(const std::string& cmd, const std::string& help, const OptionsCategory& cat)
+void ArgsManager::AddCommand(const std::string& cmd, const std::string& help)
{
Assert(cmd.find('=') == std::string::npos);
Assert(cmd.at(0) != '-');
LOCK(cs_args);
m_accept_any_command = false; // latch to false
- std::map<std::string, Arg>& arg_map = m_available_args[cat];
+ std::map<std::string, Arg>& arg_map = m_available_args[OptionsCategory::COMMANDS];
auto ret = arg_map.emplace(cmd, Arg{"", help, ArgsManager::COMMAND});
Assert(ret.second); // Fail on duplicate commands
}
@@ -1240,9 +1248,9 @@ void runCommand(const std::string& strCommand)
}
#endif
-#ifdef ENABLE_EXTERNAL_SIGNER
UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in)
{
+#ifdef ENABLE_EXTERNAL_SIGNER
namespace bp = boost::process;
UniValue result_json;
@@ -1274,8 +1282,10 @@ UniValue RunCommandParseJSON(const std::string& str_command, const std::string&
if (!result_json.read(result)) throw std::runtime_error("Unable to parse JSON: " + result);
return result_json;
-}
+#else
+ throw std::runtime_error("Compiled without external signing support (required for external signing).");
#endif // ENABLE_EXTERNAL_SIGNER
+}
void SetupEnvironment()
{
diff --git a/src/util/system.h b/src/util/system.h
index c4317c62d0..3547bad585 100644
--- a/src/util/system.h
+++ b/src/util/system.h
@@ -102,7 +102,6 @@ std::string ShellEscape(const std::string& arg);
#if HAVE_SYSTEM
void runCommand(const std::string& strCommand);
#endif
-#ifdef ENABLE_EXTERNAL_SIGNER
/**
* Execute a command which returns JSON, and parse the result.
*
@@ -111,7 +110,6 @@ void runCommand(const std::string& strCommand);
* @return parsed JSON
*/
UniValue RunCommandParseJSON(const std::string& str_command, const std::string& str_std_in="");
-#endif // ENABLE_EXTERNAL_SIGNER
/**
* Most paths passed as configuration arguments are treated as relative to
@@ -376,7 +374,7 @@ public:
/**
* Add subcommand
*/
- void AddCommand(const std::string& cmd, const std::string& help, const OptionsCategory& cat);
+ void AddCommand(const std::string& cmd, const std::string& help);
/**
* Add many hidden arguments