Various JSON Object parameters had a oneline_description
with quote characters. Fix those, and extend rpcdoccheck
to detect them.
Also, slightly improve GBT’s oneline description for template_request.
Various JSON Object parameters had a oneline_description
with quote characters. Fix those, and extend rpcdoccheck
to detect them.
Also, slightly improve GBT’s oneline description for template_request.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
See the guideline for information on the review process.
Type | Reviewers |
---|---|
ACK | MarcoFalke |
Concept ACK | russeree |
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
Reviewers, this pull request conflicts with the following ones:
seeds
argument to importdescriptors
by apoelstra)If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
1122+ if (m_opts.oneline_description[0] == '\"' && m_type != Type::STR_HEX && m_type != Type::STR && gArgs.GetBoolArg("-rpcdoccheck", DEFAULT_RPC_DOC_CHECK)) {
1123+ throw std::runtime_error{
1124+ strprintf("Internal bug detected: non-string RPC arg \"%s\" quotes oneline_description:\n%s\n%s %s\nPlease report this issue here: %s\n",
1125+ m_names, m_opts.oneline_description,
1126+ PACKAGE_NAME, FormatFullVersion(),
1127+ PACKAGE_BUGREPORT)};
nit: Could use STR_INTERNAL_BUG
?
0 STR_INTERNAL_BUG(strprintf("non-string RPC arg \"%s\" quotes oneline_description:\n%s",
1 m_names, m_opts.oneline_description)
2
3 )};
The above suggestion doesn’t compile without syntax changes due to error: unterminated argument list invoking macro "STR_INTERNAL_BUG"
This is because of a missing )
to close off the arguments for STR_INTERNAL_BUG and then there is a loose comma after m_opts.oneline_description
. Once these are removed code does compile but the output is not as clean as the current commit due to an extra "
on a new line after the name of the oneline_description
compared to the current version which doesn’t have this artifact.
No problem just was testing things. The new version compiles and looks better without the newline but it looks like a quote is appended to the m_opts.oneline_description
arg.
The current PR displays correctly "options"
It should be fine to just drop the "
, as they serve no purpose. A newline already follows the message to delimit it from the next lines.
0diff --git a/src/util/check.cpp b/src/util/check.cpp
1index 795dce7124..c4d4b0cc28 100644
2--- a/src/util/check.cpp
3+++ b/src/util/check.cpp
4@@ -18,7 +18,7 @@
5
6 std::string StrFormatInternalBug(std::string_view msg, std::string_view file, int line, std::string_view func)
7 {
8- return strprintf("Internal bug detected: \"%s\"\n%s:%d (%s)\n"
9+ return strprintf("Internal bug detected: %s\n%s:%d (%s)\n"
10 "%s %s\n"
11 "Please report this issue here: %s\n",
12 msg, file, line, func, PACKAGE_NAME, FormatFullVersion(), PACKAGE_BUGREPORT);
553@@ -554,7 +554,7 @@ static RPCHelpMan getblocktemplate()
554 " https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki#getblocktemplate_changes\n"
555 " https://github.com/bitcoin/bips/blob/master/bip-0145.mediawiki\n",
556 {
557- {"template_request", RPCArg::Type::OBJ, RPCArg::Default{UniValue::VOBJ}, "Format of the template",
558+ {"template_request", RPCArg::Type::OBJ, RPCArg::Optional::NO, "Format of the template",
template_request
can be omitted. For a new template, the client must indicate it supports segwit with the rules key. For a proposal, there must be data.
tACK
.oneline_description
and was able to trigger the desired error message.
luke-jr
DrahtBot
maflcko
russeree
Labels
RPC/REST/ZMQ