rpc: Reject beginning newline in RPC docs

It is harmless, but a bit confusing and not needed for new code.

Also, update the remaining instances that were not found by the
scripted-diff.
This commit is contained in:
MarcoFalke
2025-05-15 15:26:17 +02:00
parent fa414eda08
commit fae840e94b
4 changed files with 15 additions and 10 deletions

View File

@@ -273,8 +273,9 @@ static RPCHelpMan logging()
static RPCHelpMan echo(const std::string& name)
{
return RPCHelpMan{name,
"\nSimply echo back the input arguments. This command is for testing.\n"
return RPCHelpMan{
name,
"Simply echo back the input arguments. This command is for testing.\n"
"\nIt will return an internal bug report when arg9='trigger_internal_bug' is passed.\n"
"\nThe difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in "
"bitcoin-cli and the GUI. There is no server-side difference.",

View File

@@ -169,8 +169,9 @@ static RPCHelpMan getdescriptorinfo()
{
const std::string EXAMPLE_DESCRIPTOR = "wpkh([d34db33f/84h/0h/0h]0279be667ef9dcbbac55a06295Ce870b07029Bfcdb2dce28d959f2815b16f81798)";
return RPCHelpMan{"getdescriptorinfo",
{"\nAnalyses a descriptor.\n"},
return RPCHelpMan{
"getdescriptorinfo",
"Analyses a descriptor.\n",
{
{"descriptor", RPCArg::Type::STR, RPCArg::Optional::NO, "The descriptor."},
},
@@ -260,8 +261,9 @@ static RPCHelpMan deriveaddresses()
{
const std::string EXAMPLE_DESCRIPTOR = "wpkh([d34db33f/84h/0h/0h]xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9nrHu81fT41fvDUnhMjEzQgXnQjKEu3oaqMSzhSrHMxyyoEAmUHQbY/0/*)#cjjspncu";
return RPCHelpMan{"deriveaddresses",
{"\nDerives one or more addresses corresponding to an output descriptor.\n"
return RPCHelpMan{
"deriveaddresses",
"Derives one or more addresses corresponding to an output descriptor.\n"
"Examples of output descriptors are:\n"
" pkh(<pubkey>) P2PKH outputs for the given pubkey\n"
" wpkh(<pubkey>) Native segwit P2PKH outputs for the given pubkey\n"
@@ -270,7 +272,7 @@ static RPCHelpMan deriveaddresses()
" tr(<pubkey>,multi_a(<n>,<pubkey>,<pubkey>,...)) P2TR-multisig outputs for the given threshold and pubkeys\n"
"\nIn the above, <pubkey> either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one\n"
"or more path elements separated by \"/\", where \"h\" represents a hardened child key.\n"
"For more information on output descriptors, see the documentation in the doc/descriptors.md file.\n"},
"For more information on output descriptors, see the documentation in the doc/descriptors.md file.\n",
{
{"descriptor", RPCArg::Type::STR, RPCArg::Optional::NO, "The descriptor."},
{"range", RPCArg::Type::RANGE, RPCArg::Optional::OMITTED, "If a ranged descriptor is used, this specifies the end or the range (in [begin,end] notation) to derive."},

View File

@@ -156,11 +156,12 @@ static RPCHelpMan help()
static RPCHelpMan stop()
{
static const std::string RESULT{CLIENT_NAME " stopping"};
return RPCHelpMan{"stop",
return RPCHelpMan{
"stop",
// Also accept the hidden 'wait' integer argument (milliseconds)
// For instance, 'stop 1000' makes the call wait 1 second before returning
// to the client (intended for testing)
"\nRequest a graceful shutdown of " CLIENT_NAME ".",
"Request a graceful shutdown of " CLIENT_NAME ".",
{
{"wait", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "how long to wait in ms", RPCArgOptions{.hidden=true}},
},

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2017-2022 The Bitcoin Core developers
// Copyright (c) 2017-present The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -814,6 +814,7 @@ std::string RPCHelpMan::ToString() const
if (was_optional) ret += " )";
// Description
CHECK_NONFATAL(!m_description.starts_with('\n')); // Historically \n was required, but reject it for new code.
ret += "\n\n" + TrimString(m_description) + "\n";
// Arguments