Skip to content

Commit 609ce2d

Browse files
committed
Merge #19644: rpc: document returned error fields as optional if applicable
f110b7c rpc: document returned error fields as optional if applicable (Sebastian Falbesoner) Pull request description: The following RPCs return error fields (named `"error"` or `"errors"`) that are optional, but don't show up as optional in the help text yet: * `analyzepsbt` * `estimatesmartfee` * `signrawtransactionwithkey` * `signrawtransactionwithwallet` The following RPC has the errors field already marked as optional, but doesn't match the usual format in the description (like `"if there are any"` in parantheses): * `estimaterawfee` This PR adds the missing optional flags and adapts the description strings. Inspired by a recent PR #19634 by justinmoon. The instances were found via `git grep "RPCResult.*\"error"`. Note that there is one RPC so far where the return error is not optional (i.e. in case of no error, the field is included in the result, but is just empty), namely `bumpfee`. ACKs for top commit: adaminsky: ACK `f110b7c` laanwj: ACK f110b7c, new documentation looks consistent with actual behavior achow101: ACK f110b7c meshcollider: utACK f110b7c Tree-SHA512: 30c00f78a575b60e32b4536496af986d53a25f33e6ebbf553adcdcf825ad21a44f90267f3d1ea53326dac83bcfa9983fdb3dad6d3126e20f97f3c08ce286e188
2 parents b4d0366 + f110b7c commit 609ce2d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/rpc/mining.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ static UniValue estimatesmartfee(const JSONRPCRequest& request)
10191019
RPCResult::Type::OBJ, "", "",
10201020
{
10211021
{RPCResult::Type::NUM, "feerate", /* optional */ true, "estimate fee rate in " + CURRENCY_UNIT + "/kB (only present if no errors were encountered)"},
1022-
{RPCResult::Type::ARR, "errors", "Errors encountered during processing",
1022+
{RPCResult::Type::ARR, "errors", /* optional */ true, "Errors encountered during processing (if there are any)",
10231023
{
10241024
{RPCResult::Type::STR, "", "error"},
10251025
}},
@@ -1098,7 +1098,7 @@ static UniValue estimaterawfee(const JSONRPCRequest& request)
10981098
{
10991099
{RPCResult::Type::ELISION, "", ""},
11001100
}},
1101-
{RPCResult::Type::ARR, "errors", /* optional */ true, "Errors encountered during processing",
1101+
{RPCResult::Type::ARR, "errors", /* optional */ true, "Errors encountered during processing (if there are any)",
11021102
{
11031103
{RPCResult::Type::STR, "error", ""},
11041104
}},

src/rpc/rawtransaction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ static UniValue signrawtransactionwithkey(const JSONRPCRequest& request)
744744
{
745745
{RPCResult::Type::STR_HEX, "hex", "The hex-encoded raw transaction with signature(s)"},
746746
{RPCResult::Type::BOOL, "complete", "If the transaction has a complete set of signatures"},
747-
{RPCResult::Type::ARR, "errors", "Script verification errors (if there are any)",
747+
{RPCResult::Type::ARR, "errors", /* optional */ true, "Script verification errors (if there are any)",
748748
{
749749
{RPCResult::Type::OBJ, "", "",
750750
{
@@ -1722,7 +1722,7 @@ UniValue analyzepsbt(const JSONRPCRequest& request)
17221722
{RPCResult::Type::STR_AMOUNT, "estimated_feerate", /* optional */ true, "Estimated feerate of the final signed transaction in " + CURRENCY_UNIT + "/kB. Shown only if all UTXO slots in the PSBT have been filled"},
17231723
{RPCResult::Type::STR_AMOUNT, "fee", /* optional */ true, "The transaction fee paid. Shown only if all UTXO slots in the PSBT have been filled"},
17241724
{RPCResult::Type::STR, "next", "Role of the next person that this psbt needs to go to"},
1725-
{RPCResult::Type::STR, "error", "Error message if there is one"},
1725+
{RPCResult::Type::STR, "error", /* optional */ true, "Error message (if there is one)"},
17261726
}
17271727
},
17281728
RPCExamples {

src/wallet/rpcwallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3166,7 +3166,7 @@ UniValue signrawtransactionwithwallet(const JSONRPCRequest& request)
31663166
{
31673167
{RPCResult::Type::STR_HEX, "hex", "The hex-encoded raw transaction with signature(s)"},
31683168
{RPCResult::Type::BOOL, "complete", "If the transaction has a complete set of signatures"},
3169-
{RPCResult::Type::ARR, "errors", "Script verification errors (if there are any)",
3169+
{RPCResult::Type::ARR, "errors", /* optional */ true, "Script verification errors (if there are any)",
31703170
{
31713171
{RPCResult::Type::OBJ, "", "",
31723172
{

0 commit comments

Comments
 (0)