diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -599,6 +599,17 @@ return result; } +static std::string GetAllOutputTypes() { + std::string ret; + for (int i = TX_NONSTANDARD; i <= TX_NULL_DATA; ++i) { + if (i != TX_NONSTANDARD) { + ret += ", "; + } + ret += GetTxnOutputType(static_cast(i)); + } + return ret; +} + static UniValue decodescript(const Config &config, const JSONRPCRequest &request) { RPCHelpMan{ @@ -608,19 +619,21 @@ {"hexstring", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hex-encoded script"}, }, - RPCResult{"{\n" - " \"asm\":\"asm\", (string) Script public key\n" - " \"hex\":\"hex\", (string) hex-encoded public key\n" - " \"type\":\"type\", (string) The output type\n" - " \"reqSigs\": n, (numeric) The required signatures\n" - " \"addresses\": [ (json array of string)\n" - " \"address\" (string) bitcoin address\n" - " ,...\n" - " ],\n" - " \"p2sh\",\"address\" (string) address of P2SH script " - "wrapping this redeem script (not returned if the script is " - "already a P2SH).\n" - "}\n"}, + RPCResult{ + "{\n" + " \"asm\":\"asm\", (string) Script public key\n" + " \"type\":\"type\", (string) The output type (e.g. " + + GetAllOutputTypes() + + ")\n" + " \"reqSigs\": n, (numeric) The required signatures\n" + " \"addresses\": [ (json array of string)\n" + " \"address\" (string) bitcoin address\n" + " ,...\n" + " ],\n" + " \"p2sh\":\"str\" (string) address of P2SH script" + " wrapping this redeem script (not returned if the script" + " is already a P2SH).\n" + "}\n"}, RPCExamples{HelpExampleCli("decodescript", "\"hexstring\"") + HelpExampleRpc("decodescript", "\"hexstring\"")}, } @@ -638,7 +651,7 @@ // Empty scripts are valid. } - ScriptPubKeyToUniv(script, r, false); + ScriptPubKeyToUniv(script, r, /* fIncludeHex */ false); UniValue type; type = find_value(r, "type");