aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-03-20 15:54:37 -0400
committerMarcoFalke <falke.marco@gmail.com>2019-03-19 15:54:39 -0400
commitfa926ec24fb3d07de32bd8f67a297f9e4f0822a6 (patch)
treeadf76e3e1e23b6063eb80bab81aa72a7fbbfe83e
parentfa3caa1666a9baa856e92398a890aaddbdd98f7c (diff)
rpc: Mention all output types in decodescript doc
-rw-r--r--src/rpc/rawtransaction.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index 3e258c3862..75bf4be5f1 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -608,6 +608,16 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request)
return result;
}
+static std::string GetAllOutputTypes()
+{
+ std::string ret;
+ for (int i = TX_NONSTANDARD; i <= TX_WITNESS_UNKNOWN; ++i) {
+ if (i != TX_NONSTANDARD) ret += ", ";
+ ret += GetTxnOutputType(static_cast<txnouttype>(i));
+ }
+ return ret;
+}
+
static UniValue decodescript(const JSONRPCRequest& request)
{
const RPCHelpMan help{"decodescript",
@@ -618,14 +628,14 @@ static UniValue decodescript(const JSONRPCRequest& request)
RPCResult{
"{\n"
" \"asm\":\"asm\", (string) Script public key\n"
- " \"type\":\"type\", (string) The output type\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"
- " \"segwit\": { (json object) Result of a witness script public key wrapping this redeem script (not returned if the script is a P2SH).\n"
+ " \"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"
" \"asm\":\"str\", (string) String representation of the script public key\n"
" \"hex\":\"hexstr\", (string) Hex string of the script public key\n"
" \"type\":\"str\", (string) The type of the script public key (e.g. witness_v0_keyhash or witness_v0_scripthash)\n"