Skip to content

Commit faad33f

Browse files
author
MarcoFalke
committed
rpc: Clarify decodescript RPCResult doc
1 parent 85f0032 commit faad33f

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

src/rpc/rawtransaction.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -619,15 +619,24 @@ static UniValue decodescript(const JSONRPCRequest& request)
619619
},
620620
RPCResult{
621621
"{\n"
622-
" \"asm\":\"asm\", (string) Script public key\n"
623-
" \"hex\":\"hex\", (string) hex-encoded public key\n"
624-
" \"type\":\"type\", (string) The output type\n"
625-
" \"reqSigs\": n, (numeric) The required signatures\n"
626-
" \"addresses\": [ (json array of string)\n"
627-
" \"address\" (string) bitcoin address\n"
622+
" \"asm\":\"asm\", (string) Script public key\n"
623+
" \"type\":\"type\", (string) The output type\n"
624+
" \"reqSigs\": n, (numeric) The required signatures\n"
625+
" \"addresses\": [ (json array of string)\n"
626+
" \"address\" (string) bitcoin address\n"
628627
" ,...\n"
629628
" ],\n"
630-
" \"p2sh\",\"address\" (string) address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH).\n"
629+
" \"p2sh\":\"str\" (string) address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH).\n"
630+
" \"segwit\": { (json object) Result of a witness script public key wrapping this redeem script (not returned if the script is a P2SH).\n"
631+
" \"asm\":\"str\", (string) String representation of the script public key\n"
632+
" \"hex\":\"hexstr\", (string) Hex string of the script public key\n"
633+
" \"type\":\"str\", (string) The type of the script public key (e.g. witness_v0_keyhash or witness_v0_scripthash)\n"
634+
" \"reqSigs\": n, (numeric) The required signatures (always 1)\n"
635+
" \"addresses\": [ (json array of string) (always length 1)\n"
636+
" \"address\" (string) segwit address\n"
637+
" ,...\n"
638+
" ],\n"
639+
" \"p2sh-segwit\":\"str\" (string) address of the P2SH script wrapping this witness redeem script.\n"
631640
"}\n"
632641
},
633642
RPCExamples{
@@ -646,7 +655,7 @@ static UniValue decodescript(const JSONRPCRequest& request)
646655
} else {
647656
// Empty scripts are valid
648657
}
649-
ScriptPubKeyToUniv(script, r, false);
658+
ScriptPubKeyToUniv(script, r, /* fIncludeHex */ false);
650659

651660
UniValue type;
652661
type = find_value(r, "type");
@@ -680,7 +689,7 @@ static UniValue decodescript(const JSONRPCRequest& request)
680689
// Newer segwit program versions should be considered when then become available.
681690
segwitScr = GetScriptForDestination(WitnessV0ScriptHash(script));
682691
}
683-
ScriptPubKeyToUniv(segwitScr, sr, true);
692+
ScriptPubKeyToUniv(segwitScr, sr, /* fIncludeHex */ true);
684693
sr.pushKV("p2sh-segwit", EncodeDestination(CScriptID(segwitScr)));
685694
r.pushKV("segwit", sr);
686695
}

0 commit comments

Comments
 (0)