rpc: Clarify decodescript RPCResult doc
This commit is contained in:
parent
85f003274d
commit
faad33ff15
1 changed files with 18 additions and 9 deletions
|
@ -620,14 +620,23 @@ static UniValue decodescript(const JSONRPCRequest& request)
|
||||||
RPCResult{
|
RPCResult{
|
||||||
"{\n"
|
"{\n"
|
||||||
" \"asm\":\"asm\", (string) Script public key\n"
|
" \"asm\":\"asm\", (string) Script public key\n"
|
||||||
" \"hex\":\"hex\", (string) hex-encoded public key\n"
|
|
||||||
" \"type\":\"type\", (string) The output type\n"
|
" \"type\":\"type\", (string) The output type\n"
|
||||||
" \"reqSigs\": n, (numeric) The required signatures\n"
|
" \"reqSigs\": n, (numeric) The required signatures\n"
|
||||||
" \"addresses\": [ (json array of string)\n"
|
" \"addresses\": [ (json array of string)\n"
|
||||||
" \"address\" (string) bitcoin address\n"
|
" \"address\" (string) bitcoin address\n"
|
||||||
" ,...\n"
|
" ,...\n"
|
||||||
" ],\n"
|
" ],\n"
|
||||||
" \"p2sh\",\"address\" (string) address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH).\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"
|
||||||
|
" \"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"
|
||||||
|
" \"reqSigs\": n, (numeric) The required signatures (always 1)\n"
|
||||||
|
" \"addresses\": [ (json array of string) (always length 1)\n"
|
||||||
|
" \"address\" (string) segwit address\n"
|
||||||
|
" ,...\n"
|
||||||
|
" ],\n"
|
||||||
|
" \"p2sh-segwit\":\"str\" (string) address of the P2SH script wrapping this witness redeem script.\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
},
|
},
|
||||||
RPCExamples{
|
RPCExamples{
|
||||||
|
@ -646,7 +655,7 @@ static UniValue decodescript(const JSONRPCRequest& request)
|
||||||
} else {
|
} else {
|
||||||
// Empty scripts are valid
|
// Empty scripts are valid
|
||||||
}
|
}
|
||||||
ScriptPubKeyToUniv(script, r, false);
|
ScriptPubKeyToUniv(script, r, /* fIncludeHex */ false);
|
||||||
|
|
||||||
UniValue type;
|
UniValue type;
|
||||||
type = find_value(r, "type");
|
type = find_value(r, "type");
|
||||||
|
@ -680,7 +689,7 @@ static UniValue decodescript(const JSONRPCRequest& request)
|
||||||
// Newer segwit program versions should be considered when then become available.
|
// Newer segwit program versions should be considered when then become available.
|
||||||
segwitScr = GetScriptForDestination(WitnessV0ScriptHash(script));
|
segwitScr = GetScriptForDestination(WitnessV0ScriptHash(script));
|
||||||
}
|
}
|
||||||
ScriptPubKeyToUniv(segwitScr, sr, true);
|
ScriptPubKeyToUniv(segwitScr, sr, /* fIncludeHex */ true);
|
||||||
sr.pushKV("p2sh-segwit", EncodeDestination(CScriptID(segwitScr)));
|
sr.pushKV("p2sh-segwit", EncodeDestination(CScriptID(segwitScr)));
|
||||||
r.pushKV("segwit", sr);
|
r.pushKV("segwit", sr);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue