Merge bitcoin/bitcoin#35513: rpc: help metadata fixes
What changed, and why it matters
This commit only fixes mistakes and outdated descriptions in the automatically generated help text for Bitcoin Core's remote procedure call (RPC) commands. It does not change what the software actually does, how it processes commands, or how it handles data. The changes make the documentation match the real behavior, so there is no security risk.
No security action needed. Treat as a normal documentation cleanup merge.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch is a documentation-only update to RPC help metadata. It corrects argument/result type annotations (e.g., STR -> STR_HEX, NUM -> STR_AMOUNT for fee fields), fixes typos in descriptions (e.g., ‘received’ -> ‘receive’), marks optional/required flags accurately, and updates getnetworkinfo to use EnsureConnman/EnsurePeerman/EnsureAnyMemPool helpers. None of these changes alter runtime validation, parsing, or consensus logic.
Changed components
src/rpc/blockchain.cppsrc/rpc/fees.cppsrc/rpc/mempool.cppsrc/rpc/net.cppsrc/wallet/rpc/coins.cppsrc/wallet/rpc/transactions.cppsrc/wallet/rpc/wallet.cppInspect captured patch +41 / −47
### src/rpc/blockchain.cpp
@@ -1220,7 +1220,7 @@ static RPCMethod gettxout()
"gettxout",
"Returns details about an unspent transaction output.\n",
{
- {"txid", RPCArg::Type::STR, RPCArg::Optional::NO, "The transaction id"},
+ {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id"},
{"n", RPCArg::Type::NUM, RPCArg::Optional::NO, "vout number"},
{"include_mempool", RPCArg::Type::BOOL, RPCArg::Default{true}, "Whether to include the mempool. Note that an unspent output that is spent in the mempool won't appear."},
},
### src/rpc/fees.cpp
@@ -172,7 +172,7 @@ static std::vector<RPCResult> FeeEstimateHorizonDoc(bool elide = false)
{RPCResult::Type::OBJ, "fail", /*optional=*/true, "information about the highest range of feerates to fail to meet the threshold", FeeRateBucketDoc(/*elide=*/true)},
{RPCResult::Type::ARR, "errors", /*optional=*/true, "Errors encountered during processing (if there are any)",
{
- {RPCResult::Type::STR, "error", ""},
+ {RPCResult::Type::STR, "", "error"},
}},
};
return elide ? ElideGroup(std::move(fields)) : fields;
### src/rpc/mempool.cpp
@@ -474,7 +474,7 @@ static std::vector<RPCResult> ClusterDescription()
RPCResult{RPCResult::Type::ARR, "chunks", "chunks in this cluster (in mining order)",
{RPCResult{RPCResult::Type::OBJ, "chunk", "",
{
- RPCResult{RPCResult::Type::NUM, "chunkfee", "fees of the transactions in this chunk"},
+ RPCResult{RPCResult::Type::STR_AMOUNT, "chunkfee", "fees of the transactions in this chunk"},
RPCResult{RPCResult::Type::NUM, "chunkweight", "sigops-adjusted weight of all transactions in this chunk"},
RPCResult{RPCResult::Type::ARR, "txs", "transactions in this chunk in mining order",
{RPCResult{RPCResult::Type::STR_HEX, "txid", "transaction id"}}},
@@ -685,7 +685,7 @@ static RPCMethod getmempoolfeeratediagram()
RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::NUM, "weight", "cumulative sigops-adjusted weight"},
- {RPCResult::Type::NUM, "fee", "cumulative fee"}
+ {RPCResult::Type::STR_AMOUNT, "fee", "cumulative fee"}
}
}
}
@@ -1146,7 +1146,7 @@ static RPCMethod getmempoolinfo()
{RPCResult::Type::NUM, "maxmempool", "Maximum memory usage for the mempool"},
{RPCResult::Type::STR_AMOUNT, "mempoolminfee", "Minimum fee rate in " + CURRENCY_UNIT + "/kvB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee"},
{RPCResult::Type::STR_AMOUNT, "minrelaytxfee", "Current minimum relay fee for transactions"},
- {RPCResult::Type::NUM, "incrementalrelayfee", "minimum fee rate increment for mempool limiting or replacement in " + CURRENCY_UNIT + "/kvB"},
+ {RPCResult::Type::STR_AMOUNT, "incrementalrelayfee", "minimum fee rate increment for mempool limiting or replacement in " + CURRENCY_UNIT + "/kvB"},
{RPCResult::Type::NUM, "unbroadcastcount", "Current number of transactions that haven't passed initial broadcast yet"},
{RPCResult::Type::BOOL, "permitbaremultisig", "True if the mempool accepts transactions with bare multisig outputs"},
{RPCResult::Type::NUM, "maxdatacarriersize", "Maximum number of bytes that can be used by OP_RETURN outputs in the mempool"},
### src/rpc/net.cpp
@@ -199,7 +199,7 @@ static RPCMethod getpeerinfo()
{
{RPCResult::Type::STR, "permission_type", Join(NET_PERMISSIONS_DOC, ",\n") + ".\n"},
}},
- {RPCResult::Type::NUM, "minfeefilter", "The minimum fee rate for transactions this peer accepts"},
+ {RPCResult::Type::STR_AMOUNT, "minfeefilter", "The minimum fee rate for transactions this peer accepts"},
{RPCResult::Type::OBJ_DYN, "bytessent_per_msg", "",
{
{RPCResult::Type::NUM, "msg", "The total bytes sent aggregated by message type\n"
@@ -709,8 +709,8 @@ static RPCMethod getnetworkinfo()
{RPCResult::Type::BOOL, "proxy_randomize_credentials", "Whether randomized credentials are used"},
}},
}},
- {RPCResult::Type::NUM, "relayfee", "minimum relay fee rate for transactions in " + CURRENCY_UNIT + "/kvB"},
- {RPCResult::Type::NUM, "incrementalfee", "minimum fee rate increment for mempool limiting or replacement in " + CURRENCY_UNIT + "/kvB"},
+ {RPCResult::Type::STR_AMOUNT, "relayfee", "minimum relay fee rate for transactions in " + CURRENCY_UNIT + "/kvB"},
+ {RPCResult::Type::STR_AMOUNT, "incrementalfee", "minimum fee rate increment for mempool limiting or replacement in " + CURRENCY_UNIT + "/kvB"},
{RPCResult::Type::ARR, "localaddresses", "list of local addresses",
{
{RPCResult::Type::OBJ, "", "",
@@ -742,40 +742,34 @@ static RPCMethod getnetworkinfo()
obj.pushKV("subversion", strSubVersion);
obj.pushKV("protocolversion",PROTOCOL_VERSION);
NodeContext& node = EnsureAnyNodeContext(request.context);
- if (node.connman) {
- ServiceFlags services = node.connman->GetLocalServices();
- obj.pushKV("localservices", strprintf("%016x", services));
- obj.pushKV("localservicesnames", GetServicesNames(services));
- }
- if (node.peerman) {
- auto peerman_info{node.peerman->GetInfo()};
- obj.pushKV("localrelay", !peerman_info.ignores_incoming_txs);
- obj.pushKV("timeoffset", Ticks<std::chrono::seconds>(peerman_info.median_outbound_time_offset));
- obj.pushKV("tx_send_rate", peerman_info.tx_send_rate);
- auto buckjson = [&](const auto& buckinfo) {
- UniValue b{UniValue::VOBJ};
- b.pushKV("backlog", buckinfo.backlog_count);
- b.pushKV("count_tok", buckinfo.count_bucket);
- b.pushKV("size_tok", buckinfo.size_bucket);
- return b;
- };
- UniValue invbuckets{UniValue::VOBJ};
- invbuckets.pushKV("inbound", buckjson(peerman_info.inbound_bucket));
- invbuckets.pushKV("outbound", buckjson(peerman_info.outbound_bucket));
- obj.pushKV("inv_buckets", invbuckets);
- }
- if (node.connman) {
- obj.pushKV("networkactive", node.connman->GetNetworkActive());
- obj.pushKV("connections", node.connman->GetNodeCount(ConnectionDirection::Both));
- obj.pushKV("connections_in", node.connman->GetNodeCount(ConnectionDirection::In));
- obj.pushKV("connections_out", node.connman->GetNodeCount(ConnectionDirection::Out));
- }
+ CConnman& connman = EnsureConnman(node);
+ ServiceFlags services = connman.GetLocalServices();
+ obj.pushKV("localservices", strprintf("%016x", services));
+ obj.pushKV("localservicesnames", GetServicesNames(services));
+ auto peerman_info{EnsurePeerman(node).GetInfo()};
+ obj.pushKV("localrelay", !peerman_info.ignores_incoming_txs);
+ obj.pushKV("timeoffset", Ticks<std::chrono::seconds>(peerman_info.median_outbound_time_offset));
+ obj.pushKV("tx_send_rate", peerman_info.tx_send_rate);
+ auto buckjson = [&](const auto& buckinfo) {
+ UniValue b{UniValue::VOBJ};
+ b.pushKV("backlog", buckinfo.backlog_count);
+ b.pushKV("count_tok", buckinfo.count_bucket);
+ b.pushKV("size_tok", buckinfo.size_bucket);
+ return b;
+ };
+ UniValue invbuckets{UniValue::VOBJ};
+ invbuckets.pushKV("inbound", buckjson(peerman_info.inbound_bucket));
+ invbuckets.pushKV("outbound", buckjson(peerman_info.outbound_bucket));
+ obj.pushKV("inv_buckets", invbuckets);
+ obj.pushKV("networkactive", connman.GetNetworkActive());
+ obj.pushKV("connections", connman.GetNodeCount(ConnectionDirection::Both));
+ obj.pushKV("connections_in", connman.GetNodeCount(ConnectionDirection::In));
+ obj.pushKV("connections_out", connman.GetNodeCount(ConnectionDirection::Out));
obj.pushKV("networks", GetNetworksInfo());
- if (node.mempool) {
- // Those fields can be deprecated, to be replaced by the getmempoolinfo fields
- obj.pushKV("relayfee", ValueFromAmount(node.mempool->m_opts.min_relay_feerate.GetFeePerK()));
- obj.pushKV("incrementalfee", ValueFromAmount(node.mempool->m_opts.incremental_relay_feerate.GetFeePerK()));
- }
+ const CTxMemPool& mempool = EnsureAnyMemPool(request.context);
+ // Those fields can be deprecated, to be replaced by the getmempoolinfo fields
+ obj.pushKV("relayfee", ValueFromAmount(mempool.m_opts.min_relay_feerate.GetFeePerK()));
+ obj.pushKV("incrementalfee", ValueFromAmount(mempool.m_opts.incremental_relay_feerate.GetFeePerK()));
UniValue localAddresses(UniValue::VARR);
{
LOCK(g_maplocalhost_mutex);
### src/wallet/rpc/coins.cpp
@@ -490,7 +490,7 @@ RPCMethod listunspent()
{RPCResult::Type::NUM, "vout", "the vout value"},
{RPCResult::Type::STR, "address", /*optional=*/true, "the bitcoin address"},
{RPCResult::Type::STR, "label", /*optional=*/true, "The associated label, or \"\" for the default label"},
- {RPCResult::Type::STR, "scriptPubKey", "the output script"},
+ {RPCResult::Type::STR_HEX, "scriptPubKey", "the output script"},
{RPCResult::Type::STR_AMOUNT, "amount", "the transaction output amount in " + CURRENCY_UNIT},
{RPCResult::Type::NUM, "confirmations", "The number of confirmations"},
{RPCResult::Type::NUM, "ancestorcount", /*optional=*/true, "The number of in-mempool ancestor transactions, including this one (if transaction is in the mempool)"},
### src/wallet/rpc/transactions.cpp
@@ -426,7 +426,7 @@ static std::vector<RPCResult> TransactionDescriptionString()
{RPCResult::Type::STR, "comment", /*optional=*/true, "If a comment is associated with the transaction, only present if not empty."},
{RPCResult::Type::STR, "bip125-replaceable", /*optional=*/true, "(\"yes|no|unknown\") (DEPRECATED) Whether this transaction signals BIP125 replaceability or has an unconfirmed ancestor signaling BIP125 replaceability.\n"
"May be unknown for unconfirmed transactions not in the mempool because their unconfirmed ancestors are unknown."},
- {RPCResult::Type::ARR, "parent_descs", /*optional=*/true, "Only if 'category' is 'received'. List of parent descriptors for the output script of this coin.", {
+ {RPCResult::Type::ARR, "parent_descs", /*optional=*/true, "Only if 'category' is 'receive'. List of parent descriptors for the output script of this coin.", {
{RPCResult::Type::STR, "desc", "The descriptor string."},
}},
};
@@ -726,7 +726,7 @@ RPCMethod gettransaction()
{RPCResult::Type::STR_AMOUNT, "fee", /*optional=*/true, "The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n"
"'send' category of transactions."},
{RPCResult::Type::BOOL, "abandoned", "'true' if the transaction has been abandoned (inputs are respendable)."},
- {RPCResult::Type::ARR, "parent_descs", /*optional=*/true, "Only if 'category' is 'received'. List of parent descriptors for the output script of this coin.", {
+ {RPCResult::Type::ARR, "parent_descs", /*optional=*/true, "Only if 'category' is 'receive'. List of parent descriptors for the output script of this coin.", {
{RPCResult::Type::STR, "desc", "The descriptor string."},
}},
}},
### src/wallet/rpc/wallet.cpp
@@ -54,7 +54,7 @@ static RPCMethod getwalletinfo()
{RPCResult::Type::STR, "format", "the database format (only sqlite)"},
{RPCResult::Type::NUM, "txcount", "the total number of transactions in the wallet"},
{RPCResult::Type::NUM, "keypoolsize", "how many new keys are pre-generated (only counts external keys)"},
- {RPCResult::Type::NUM, "keypoolsize_hd_internal", /*optional=*/true, "how many new keys are pre-generated for internal use (used for change outputs, only appears if the wallet is using this feature, otherwise external keys are used)"},
+ {RPCResult::Type::NUM, "keypoolsize_hd_internal", "how many new keys are pre-generated for internal use (used for change outputs; 0 if external keys are used for change)"},
{RPCResult::Type::NUM_TIME, "unlocked_until", /*optional=*/true, "the " + UNIX_EPOCH_TIME + " until which the wallet is unlocked for transfers, or 0 if the wallet is locked (only present for passphrase-encrypted wallets)"},
{RPCResult::Type::BOOL, "private_keys_enabled", "false if privatekeys are disabled for this wallet (enforced watch-only wallet)"},
{RPCResult::Type::BOOL, "avoid_reuse", "whether this wallet tracks clean/dirty coins in terms of reuse"},
@@ -155,7 +155,7 @@ static RPCMethod listwalletdir()
{RPCResult::Type::OBJ, "", "",
{
{RPCResult::Type::STR, "name", "The wallet name"},
- {RPCResult::Type::ARR, "warnings", /*optional=*/true, "Warning messages, if any, related to loading the wallet.",
+ {RPCResult::Type::ARR, "warnings", "Warning messages related to loading the wallet (may be empty).",
{
{RPCResult::Type::STR, "", ""},
}},
@@ -501,7 +501,7 @@ RPCMethod simulaterawtransaction()
"simulaterawtransaction",
"Calculate the balance change resulting in the signing and broadcasting of the given transaction(s).\n",
{
- {"rawtxs", RPCArg::Type::ARR, RPCArg::Optional::OMITTED, "An array of hex strings of raw transactions.\n",
+ {"rawtxs", RPCArg::Type::ARR, RPCArg::Optional::NO, "An array of hex strings of raw transactions.\n",
{
{"rawtx", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, ""},
},Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.