Skip to content

Commit fa926ec

Browse files
author
MarcoFalke
committed
rpc: Mention all output types in decodescript doc
1 parent fa3caa1 commit fa926ec

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/rpc/rawtransaction.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,16 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request)
608608
return result;
609609
}
610610

611+
static std::string GetAllOutputTypes()
612+
{
613+
std::string ret;
614+
for (int i = TX_NONSTANDARD; i <= TX_WITNESS_UNKNOWN; ++i) {
615+
if (i != TX_NONSTANDARD) ret += ", ";
616+
ret += GetTxnOutputType(static_cast<txnouttype>(i));
617+
}
618+
return ret;
619+
}
620+
611621
static UniValue decodescript(const JSONRPCRequest& request)
612622
{
613623
const RPCHelpMan help{"decodescript",
@@ -618,14 +628,14 @@ static UniValue decodescript(const JSONRPCRequest& request)
618628
RPCResult{
619629
"{\n"
620630
" \"asm\":\"asm\", (string) Script public key\n"
621-
" \"type\":\"type\", (string) The output type\n"
631+
" \"type\":\"type\", (string) The output type (e.g. "+GetAllOutputTypes()+")\n"
622632
" \"reqSigs\": n, (numeric) The required signatures\n"
623633
" \"addresses\": [ (json array of string)\n"
624634
" \"address\" (string) bitcoin address\n"
625635
" ,...\n"
626636
" ],\n"
627637
" \"p2sh\":\"str\" (string) address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH).\n"
628-
" \"segwit\": { (json object) Result of a witness script public key wrapping this redeem script (not returned if the script is a P2SH).\n"
638+
" \"segwit\": { (json object) Result of a witness script public key wrapping this redeem script (not returned if the script is a P2SH or witness).\n"
629639
" \"asm\":\"str\", (string) String representation of the script public key\n"
630640
" \"hex\":\"hexstr\", (string) Hex string of the script public key\n"
631641
" \"type\":\"str\", (string) The type of the script public key (e.g. witness_v0_keyhash or witness_v0_scripthash)\n"

0 commit comments

Comments
 (0)