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 committed 2025-05-15 16:34:27 +02:00
1 parent fa414eda08
commit fae840e94b
4 files changed
+15 -10

No files matched your search

+3 -2
View File
@@ -273,8 +273,9 @@ static RPCHelpMan logging()
static RPCHelpMan echo(const std::string& name) static RPCHelpMan echo(const std::string& name)
{ {
return RPCHelpMan{name, return RPCHelpMan{
"\nSimply echo back the input arguments. This command is for testing.\n" 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" "\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 " "\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.", "bitcoin-cli and the GUI. There is no server-side difference.",
+7 -5
View File
@@ -169,8 +169,9 @@ static RPCHelpMan getdescriptorinfo()
{ {
const std::string EXAMPLE_DESCRIPTOR = "wpkh([d34db33f/84h/0h/0h]0279be667ef9dcbbac55a06295Ce870b07029Bfcdb2dce28d959f2815b16f81798)"; const std::string EXAMPLE_DESCRIPTOR = "wpkh([d34db33f/84h/0h/0h]0279be667ef9dcbbac55a06295Ce870b07029Bfcdb2dce28d959f2815b16f81798)";
return RPCHelpMan{"getdescriptorinfo", return RPCHelpMan{
{"\nAnalyses a descriptor.\n"}, "getdescriptorinfo",
"Analyses a descriptor.\n",
{ {
{"descriptor", RPCArg::Type::STR, RPCArg::Optional::NO, "The descriptor."}, {"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"; const std::string EXAMPLE_DESCRIPTOR = "wpkh([d34db33f/84h/0h/0h]xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9nrHu81fT41fvDUnhMjEzQgXnQjKEu3oaqMSzhSrHMxyyoEAmUHQbY/0/*)#cjjspncu";
return RPCHelpMan{"deriveaddresses", return RPCHelpMan{
{"\nDerives one or more addresses corresponding to an output descriptor.\n" "deriveaddresses",
"Derives one or more addresses corresponding to an output descriptor.\n"
"Examples of output descriptors are:\n" "Examples of output descriptors are:\n"
" pkh(<pubkey>) P2PKH outputs for the given pubkey\n" " pkh(<pubkey>) P2PKH outputs for the given pubkey\n"
" wpkh(<pubkey>) Native segwit 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" " 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" "\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" "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."}, {"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."}, {"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."},
+3 -2
View File
@@ -156,11 +156,12 @@ static RPCHelpMan help()
static RPCHelpMan stop() static RPCHelpMan stop()
{ {
static const std::string RESULT{CLIENT_NAME " stopping"}; static const std::string RESULT{CLIENT_NAME " stopping"};
return RPCHelpMan{"stop", return RPCHelpMan{
"stop",
// Also accept the hidden 'wait' integer argument (milliseconds) // Also accept the hidden 'wait' integer argument (milliseconds)
// For instance, 'stop 1000' makes the call wait 1 second before returning // For instance, 'stop 1000' makes the call wait 1 second before returning
// to the client (intended for testing) // 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}}, {"wait", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "how long to wait in ms", RPCArgOptions{.hidden=true}},
}, },
+2 -1
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 // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -814,6 +814,7 @@ std::string RPCHelpMan::ToString() const
if (was_optional) ret += " )"; if (was_optional) ret += " )";
// Description // 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"; ret += "\n\n" + TrimString(m_description) + "\n";
// Arguments // Arguments