diff options
author | MacroFake <falke.marco@gmail.com> | 2022-05-19 06:44:08 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-05-19 06:44:55 +0200 |
commit | bb83aba6c98b948c1715b26237980a4ddc87a547 (patch) | |
tree | 9f35283c8248048f05bdf38959cff398b15f5838 /src/rpc | |
parent | 7b3343f3009d38abe2de10e9fdc7f702d6a2cf1b (diff) | |
parent | b953ea6cc691ba61bf08eb186e76e7e8b7ba8120 (diff) | |
download | bitcoin-bb83aba6c98b948c1715b26237980a4ddc87a547.tar.xz |
Merge bitcoin/bitcoin#25161: rpc: Put undocumented JSON failure mode behind a runtime flag
b953ea6cc691ba61bf08eb186e76e7e8b7ba8120 rpc: Put undocumented JSON failure mode behind a runtime flag (Suhail Saqan)
Pull request description:
Fixes #24695 (Put undocumented JSON failure mode behind a runtime flag)
ACKs for top commit:
luke-jr:
utACK b953ea6cc691ba61bf08eb186e76e7e8b7ba8120
vincenzopalazzo:
ACK https://github.com/bitcoin/bitcoin/pull/25161/commits/b953ea6cc691ba61bf08eb186e76e7e8b7ba8120
Tree-SHA512: 2005ee1b1f3b637918390b2ecd4166f2fd8c86e3c59fba3da8a0cbd5b1dffd03190c92f6dca3c489ecce4276eaf3108b2edcf9cd6224b713adb52f5bb848163b
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/util.cpp | 5 | ||||
-rw-r--r-- | src/rpc/util.h | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index a5f5494259..932c93b48c 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -12,6 +12,7 @@ #include <util/check.h> #include <util/strencodings.h> #include <util/string.h> +#include <util/system.h> #include <util/translation.h> #include <tuple> @@ -581,7 +582,9 @@ UniValue RPCHelpMan::HandleRequest(const JSONRPCRequest& request) const throw std::runtime_error(ToString()); } const UniValue ret = m_fun(*this, request); - CHECK_NONFATAL(std::any_of(m_results.m_results.begin(), m_results.m_results.end(), [ret](const RPCResult& res) { return res.MatchesType(ret); })); + if (gArgs.GetBoolArg("-rpcdoccheck", DEFAULT_RPC_DOC_CHECK)) { + CHECK_NONFATAL(std::any_of(m_results.m_results.begin(), m_results.m_results.end(), [ret](const RPCResult& res) { return res.MatchesType(ret); })); + } return ret; } diff --git a/src/rpc/util.h b/src/rpc/util.h index e16fed75bc..6e23caff6c 100644 --- a/src/rpc/util.h +++ b/src/rpc/util.h @@ -22,6 +22,8 @@ #include <variant> #include <vector> +static constexpr bool DEFAULT_RPC_DOC_CHECK{false}; + /** * String used to describe UNIX epoch time in documentation, factored out to a * constant for consistency. |