Skip to content

Commit b86b35f

Browse files
committed
fix RPC documentation inconsistencies
1 parent d99ecc9 commit b86b35f

3 files changed

Lines changed: 22 additions & 25 deletions

File tree

src/rpc/blockchain.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,6 @@ static RPCHelpMan getblockheader()
641641
{RPCResult::Type::NUM_TIME, "mediantime", "The median block time expressed in " + UNIX_EPOCH_TIME},
642642
{RPCResult::Type::NUM, "nonce", /*optional=*/true, "The nonce"},
643643
{RPCResult::Type::STR_HEX, "bits", /*optional=*/true, "The bits"},
644-
{RPCResult::Type::STR_HEX, "target", /*optional=*/true, "The difficulty target"},
645644
{RPCResult::Type::NUM, "difficulty", /*optional=*/true, "The difficulty"},
646645
{RPCResult::Type::STR_HEX, "chainwork", /*optional=*/true, "Expected number of hashes required to produce the current chain"},
647646
{RPCResult::Type::NUM, "nTx", "The number of transactions in the block"},
@@ -843,7 +842,6 @@ static RPCHelpMan getblock()
843842
{RPCResult::Type::NUM_TIME, "mediantime", "The median block time expressed in " + UNIX_EPOCH_TIME},
844843
{RPCResult::Type::NUM, "nonce", /*optional=*/true, "The nonce"},
845844
{RPCResult::Type::STR_HEX, "bits", /*optional=*/true, "The bits"},
846-
{RPCResult::Type::STR_HEX, "target", /*optional=*/true, "The difficulty target"},
847845
{RPCResult::Type::NUM, "difficulty", /*optional=*/true, "The difficulty"},
848846
{RPCResult::Type::STR_HEX, "chainwork", /*optional=*/true, "Expected number of hashes required to produce the chain up to this block"},
849847
{RPCResult::Type::NUM, "nTx", "The number of transactions in the block"},
@@ -867,7 +865,7 @@ static RPCHelpMan getblock()
867865
{RPCResult::Type::ELISION, "", ""}
868866
}},
869867
}},
870-
{RPCResult::Type::OBJ, "proposed", "Proposed parameters. Uninforced. Must be published in full",
868+
{RPCResult::Type::OBJ, "proposed", "Proposed parameters. Unenforced. Must be published in full",
871869
{
872870
{RPCResult::Type::ELISION, "", "same entries as \"current\""}
873871
}},
@@ -2477,7 +2475,7 @@ static RPCHelpMan scantxoutset()
24772475
{RPCResult::Type::STR_HEX, "scriptPubKey", "The output script"},
24782476
{RPCResult::Type::STR, "desc", "A specialized descriptor for the matched output script"},
24792477
{RPCResult::Type::STR_AMOUNT, "amount", "The total amount in " + CURRENCY_UNIT + " of the unspent output"},
2480-
{RPCResult::Type::STR_HEX, "asset", "The asset ID"},
2478+
{RPCResult::Type::STR_HEX, "asset", /*optional=*/true, "The asset ID"},
24812479
{RPCResult::Type::BOOL, "coinbase", "Whether this is a coinbase output"},
24822480
{RPCResult::Type::NUM, "height", "Height of the unspent transaction output"},
24832481
{RPCResult::Type::STR_HEX, "blockhash", "Blockhash of the unspent transaction output"},
@@ -2902,7 +2900,7 @@ static RPCHelpMan getdescriptoractivity()
29022900
{RPCResult::Type::STR_HEX, "spend_txid", "The txid of the spending transaction"},
29032901
{RPCResult::Type::NUM, "spend_vout", "The vout of the spend"},
29042902
{RPCResult::Type::STR_HEX, "prevout_txid", "The txid of the prevout"},
2905-
{RPCResult::Type::NUM, "prevout_vout", "The vout of the prevout"},
2903+
{RPCResult::Type::NUM, "prevout_vin", "The vin of the prevout"},
29062904
{RPCResult::Type::OBJ, "prevout_spk", "", ScriptPubKeyDoc()},
29072905
}},
29082906
{RPCResult::Type::OBJ, "", "", {
@@ -3679,10 +3677,10 @@ static RPCHelpMan getsidechaininfo()
36793677
RPCResult::Type::OBJ, "", "",
36803678
{
36813679
{RPCResult::Type::STR_HEX, "fedpegscript", "The fedpegscript from genesis block"},
3682-
{RPCResult::Type::ARR, "current_fedpegscripts", "The currently-enforced fedpegscripts in hex. Peg-ins for any entries on this list are honored by consensus and policy. Newest first. Two total entries are possible",
3683-
{{RPCResult::Type::STR_HEX, "", "active fedpegscript"}}},
36843680
{RPCResult::Type::ARR, "current_fedpeg_programs", "The currently-enforced fedpegscript scriptPubKeys in hex. Prior to a transition this may be P2SH scriptpubkey, otherwise it will be a native segwit script. Results are paired in-order with current_fedpegscripts",
36853681
{{RPCResult::Type::STR_HEX, "", "active fedpegscript scriptPubKeys"}}},
3682+
{RPCResult::Type::ARR, "current_fedpegscripts", "The currently-enforced fedpegscripts in hex. Peg-ins for any entries on this list are honored by consensus and policy. Newest first. Two total entries are possible",
3683+
{{RPCResult::Type::STR_HEX, "", "active fedpegscript"}}},
36863684
{RPCResult::Type::STR_HEX, "pegged_asset", "Pegged asset type"},
36873685
{RPCResult::Type::STR, "min_peg_diff", "The minimum difficulty parent chain header target. Peg-in headers that have less work will be rejected as an anti-Dos measure"},
36883686
{RPCResult::Type::STR_HEX, "parent_blockhash", "The parent genesis blockhash as source of pegged-in funds"},

src/rpc/mining.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -450,14 +450,14 @@ static RPCHelpMan getmininginfo()
450450
{RPCResult::Type::NUM, "networkhashps", /*optional=*/true, "The network hashes per second"},
451451
{RPCResult::Type::NUM, "pooledtx", "The size of the mempool"},
452452
{RPCResult::Type::STR, "chain", "current network name (" LIST_CHAIN_NAMES ")"},
453-
{RPCResult::Type::STR_HEX, "signet_challenge", /*optional=*/true, "The block challenge (aka. block script), in hexadecimal (only present if the current network is a signet)"},
454-
{RPCResult::Type::OBJ, "next", "The next block",
453+
{RPCResult::Type::OBJ, "next", /*optional=*/true, "The next block",
455454
{
456455
{RPCResult::Type::NUM, "height", "The next height"},
457456
{RPCResult::Type::STR_HEX, "bits", "The next target nBits"},
458457
{RPCResult::Type::NUM, "difficulty", "The next difficulty"},
459458
{RPCResult::Type::STR_HEX, "target", "The next target"}
460459
}},
460+
{RPCResult::Type::STR_HEX, "signet_challenge", /*optional=*/true, "The block challenge (aka. block script), in hexadecimal (only present if the current network is a signet)"},
461461
(IsDeprecatedRPCEnabled("warnings") ?
462462
RPCResult{RPCResult::Type::STR, "warnings", "any network and blockchain warnings (DEPRECATED)"} :
463463
RPCResult{RPCResult::Type::ARR, "warnings", "any network and blockchain warnings (run with `-deprecatedrpc=warnings` to return the latest warning as a single string)",
@@ -663,6 +663,10 @@ static RPCHelpMan getblocktemplate()
663663
RPCResult{"If the proposal was not accepted with mode=='proposal'", RPCResult::Type::STR, "", "According to BIP22"},
664664
RPCResult{"Otherwise", RPCResult::Type::OBJ, "", "",
665665
{
666+
{RPCResult::Type::ARR, "capabilities", "",
667+
{
668+
{RPCResult::Type::STR, "value", "A supported feature, for example 'proposal'"},
669+
}},
666670
{RPCResult::Type::NUM, "version", "The preferred block version"},
667671
{RPCResult::Type::ARR, "rules", "specific block rules that are to be enforced",
668672
{
@@ -672,10 +676,6 @@ static RPCHelpMan getblocktemplate()
672676
{
673677
{RPCResult::Type::NUM, "rulename", "identifies the bit number as indicating acceptance and readiness for the named softfork rule"},
674678
}},
675-
{RPCResult::Type::ARR, "capabilities", "",
676-
{
677-
{RPCResult::Type::STR, "value", "A supported feature, for example 'proposal'"},
678-
}},
679679
{RPCResult::Type::NUM, "vbrequired", "bit mask of versionbits the server requires set in submissions"},
680680
{RPCResult::Type::STR, "previousblockhash", "The hash of current highest block"},
681681
{RPCResult::Type::ARR, "transactions", "contents of non-coinbase transactions that should be included in the next block",
@@ -1262,7 +1262,7 @@ static RPCHelpMan getnewblockhex()
12621262

12631263
std::unique_ptr<CBlockTemplate> pblocktemplate(BlockAssembler(chainman.ActiveChainstate(), node.mempool.get(), options).CreateNewBlock());
12641264
if (!pblocktemplate.get()) {
1265-
throw JSONRPCError(RPC_INTERNAL_ERROR, "Wallet keypool empty");
1265+
throw JSONRPCError(RPC_INTERNAL_ERROR, "Block template empty");
12661266
}
12671267

12681268
{
@@ -1310,7 +1310,7 @@ static RPCHelpMan combineblocksigs()
13101310
},
13111311
},
13121312
},
1313-
{"witnessScript", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "The hex-encoded witnessScript for the signblockscript"},
1313+
{"witnessScript", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hex-encoded witnessScript for the signblockscript"},
13141314
},
13151315
RPCResult{
13161316
RPCResult::Type::OBJ, "", "",
@@ -1391,7 +1391,7 @@ static RPCHelpMan getcompactsketch()
13911391
{"block_hex", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Hex serialized block proposal from `getnewblockhex`."},
13921392
},
13931393
RPCResult{
1394-
RPCResult::Type::STR, "sketch", "serialized block sketch",
1394+
RPCResult::Type::STR_HEX, "sketch", "serialized block sketch",
13951395
},
13961396
RPCExamples{
13971397
HelpExampleCli("getcompactsketch", ""),

src/rpc/rawtransaction.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ static RPCHelpMan getrawtransaction()
343343
},
344344
{
345345
RPCResult{"if verbosity is not set or set to 0",
346-
RPCResult::Type::STR, "data", "The serialized transaction as a hex-encoded string for 'txid'"
346+
RPCResult::Type::STR_HEX, "data", "The serialized transaction as a hex-encoded string for 'txid'"
347347
},
348348
RPCResult{"if verbosity is set to 1",
349349
RPCResult::Type::OBJ, "", "",
@@ -711,7 +711,7 @@ static RPCHelpMan combinerawtransaction()
711711
},
712712
},
713713
RPCResult{
714-
RPCResult::Type::STR, "", "The hex-encoded raw transaction with signature(s)"
714+
RPCResult::Type::STR_HEX, "", "The hex-encoded raw transaction with signature(s)"
715715
},
716716
RPCExamples{
717717
HelpExampleCli("combinerawtransaction", R"('["myhex1", "myhex2", "myhex3"]')")
@@ -795,7 +795,7 @@ static RPCHelpMan signrawtransactionwithkey()
795795
{"hexstring", RPCArg::Type::STR, RPCArg::Optional::NO, "The transaction hex string"},
796796
{"privkeys", RPCArg::Type::ARR, RPCArg::Optional::NO, "The base58-encoded private keys for signing",
797797
{
798-
{"privatekey", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "private key in base58-encoding"},
798+
{"privatekey", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "private key in base58-encoding"},
799799
},
800800
},
801801
{"prevtxs", RPCArg::Type::ARR, RPCArg::Optional::OMITTED, "The previous dependent transaction outputs",
@@ -1171,9 +1171,8 @@ static RPCHelpMan decodepsbt()
11711171
}},
11721172
{RPCResult::Type::NUM, "tx_version", /*optional=*/true, "The version number of the unsigned transaction. Not to be confused with PSBT version"},
11731173
{RPCResult::Type::NUM, "fallback_locktime", /*optional=*/true, "The locktime to fallback to if no inputs specify a required locktime."},
1174-
{RPCResult::Type::NUM, "fees", "The fees specified in this psbt.", {}, /*skip_type_check=*/true}, // ELEMENTS has an explicit fee output, bitcoin does not (they are implicit)
1175-
{RPCResult::Type::NUM, "input_count", "The number of inputs in this psbt"},
1176-
{RPCResult::Type::NUM, "output_count", "The number of outputs in this psbt."},
1174+
{RPCResult::Type::NUM, "input_count", /*optional=*/true, "The number of inputs in this psbt"},
1175+
{RPCResult::Type::NUM, "output_count", /*optional=*/true, "The number of outputs in this psbt."},
11771176
{RPCResult::Type::BOOL, "inputs_modifiable", /*optional=*/true, "Whether inputs can be modified"},
11781177
{RPCResult::Type::BOOL, "outputs_modifiable", /*optional=*/true, "Whether outputs can be modified"},
11791178
{RPCResult::Type::BOOL, "has_sighash_single", /*optional=*/true, "Whether this PSBT has SIGHASH_SINGLE inputs"},
@@ -2608,7 +2607,7 @@ static RPCHelpMan rawblindrawtransaction()
26082607
{"ignoreblindfail", RPCArg::Type::BOOL, RPCArg::Default{true}, "Return a transaction even when a blinding attempt fails due to number of blinded inputs/outputs."},
26092608
},
26102609
RPCResult{
2611-
RPCResult::Type::STR, "transaction", "hex string of the transaction"
2610+
RPCResult::Type::STR_HEX, "transaction", "hex string of the transaction"
26122611
},
26132612
RPCExamples{""},
26142613
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
@@ -2642,7 +2641,7 @@ static RPCHelpMan rawblindrawtransaction()
26422641
}
26432642
if (inputAmounts.size() != tx.vin.size()) {
26442643
throw JSONRPCError(RPC_INVALID_PARAMETER,
2645-
"Invalid parameter: one (potentially empty) input blind for each input must be provided");
2644+
"Invalid parameter: one (potentially empty) input amount for each input must be provided");
26462645
}
26472646
if (inputAssets.size() != tx.vin.size()) {
26482647
throw JSONRPCError(RPC_INVALID_PARAMETER,
@@ -2694,7 +2693,7 @@ static RPCHelpMan rawblindrawtransaction()
26942693
if (!IsHex(assetblind) || assetblind.length() != 32*2)
26952694
throw JSONRPCError(RPC_INVALID_PARAMETER, "input asset blinds must be an array of 32-byte hex-encoded strings");
26962695
if (!IsHex(asset) || asset.length() != 32*2)
2697-
throw JSONRPCError(RPC_INVALID_PARAMETER, "input asset blinds must be an array of 32-byte hex-encoded strings");
2696+
throw JSONRPCError(RPC_INVALID_PARAMETER, "input asset IDs must be an array of 32-byte hex-encoded strings");
26982697

26992698
input_blinds.push_back(uint256S(blind));
27002699
input_asset_blinds.push_back(uint256S(assetblind));

0 commit comments

Comments
 (0)