From 80f1060757786d96bf384fae3694e11910c1b180 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Thu, 2 Oct 2025 23:48:00 +0700 Subject: [PATCH 01/10] fix: missing changes from 20459 --- src/rpc/util.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index 60d7ddd10104..afbf34ca7e0c 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -536,7 +536,9 @@ UniValue RPCHelpMan::HandleRequest(const JSONRPCRequest& request) const if (request.mode == JSONRPCRequest::GET_HELP || !IsValidNumArgs(request.params.size())) { throw std::runtime_error(ToString()); } - return m_fun(*this, request); + 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); })); + return ret; } bool RPCHelpMan::IsValidNumArgs(size_t num_args) const From 5f683dc513d7626df29c2e090629ec7b0014dc48 Mon Sep 17 00:00:00 2001 From: MacroFake Date: Thu, 19 May 2022 06:44:08 +0200 Subject: [PATCH 02/10] 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 --- src/init.cpp | 1 + src/rpc/util.cpp | 6 ++++-- src/rpc/util.h | 2 ++ test/functional/test_framework/util.py | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 18d1cafe92c8..cb7eda0f5d3d 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -775,6 +775,7 @@ void SetupServerArgs(ArgsManager& argsman) argsman.AddArg("-rpcallowip=", "Allow JSON-RPC connections from specified source. Valid values for are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0), a network/CIDR (e.g. 1.2.3.4/24), all ipv4 (0.0.0.0/0), or all ipv6 (::/0). This option can be specified multiple times", ArgsManager::ALLOW_ANY, OptionsCategory::RPC); argsman.AddArg("-rpcauth=", "Username and HMAC-SHA-256 hashed password for JSON-RPC connections. The field comes in the format: :$. A canonical python script is included in share/rpcuser. The client then connects normally using the rpcuser=/rpcpassword= pair of arguments. This option can be specified multiple times", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::RPC); argsman.AddArg("-rpcbind=[:port]", "Bind to given address to listen for JSON-RPC connections. Do not expose the RPC server to untrusted networks such as the public internet! This option is ignored unless -rpcallowip is also passed. Port is optional and overrides -rpcport. Use [host]:port notation for IPv6. This option can be specified multiple times (default: 127.0.0.1 and ::1 i.e., localhost, or if -rpcallowip has been specified, 0.0.0.0 and :: i.e., all addresses)", ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::RPC); + argsman.AddArg("-rpcdoccheck", strprintf("Throw a non-fatal error at runtime if the documentation for an RPC is incorrect (default: %u)", DEFAULT_RPC_DOC_CHECK), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::RPC); argsman.AddArg("-rpccookiefile=", "Location of the auth cookie. Relative paths will be prefixed by a net-specific datadir location. (default: data dir)", ArgsManager::ALLOW_ANY, OptionsCategory::RPC); argsman.AddArg("-rpcexternaluser=", "List of comma-separated usernames for JSON-RPC external connections", ArgsManager::ALLOW_ANY | ArgsManager::SENSITIVE, OptionsCategory::RPC); argsman.AddArg("-rpcexternalworkqueue=", strprintf("Set the depth of the work queue to service external RPC calls (default: %d)", DEFAULT_HTTP_WORKQUEUE), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::RPC); diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index afbf34ca7e0c..69f8ae73c599 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -12,9 +12,9 @@ #include