| 742 | } |
| 743 | |
| 744 | UniValue decodescript(const UniValue& params, bool fHelp) |
| 745 | { |
| 746 | if (fHelp || params.size() != 1) |
| 747 | throw runtime_error( |
| 748 | "decodescript \"hex\"\n" |
| 749 | "\nDecode a hex-encoded script.\n" |
| 750 | "\nArguments:\n" |
| 751 | "1. \"hex\" (string) the hex encoded script\n" |
| 752 | "\nResult:\n" |
| 753 | "{\n" |
| 754 | " \"asm\":\"asm\", (string) Script public key\n" |
| 755 | " \"hex\":\"hex\", (string) hex encoded public key\n" |
| 756 | " \"type\":\"type\", (string) The output type\n" |
| 757 | " \"reqSigs\": n, (numeric) The required signatures\n" |
| 758 | " \"addresses\": [ (json array of string)\n" |
| 759 | " \"address\" (string) lux address\n" |
| 760 | " ,...\n" |
| 761 | " ],\n" |
| 762 | " \"p2sh\",\"address\" (string) script address\n" |
| 763 | "}\n" |
| 764 | "\nExamples:\n" + |
| 765 | HelpExampleCli("decodescript", "\"hexstring\"") + HelpExampleRpc("decodescript", "\"hexstring\"")); |
| 766 | |
| 767 | LOCK(cs_main); |
| 768 | |
| 769 | RPCTypeCheck(params, list_of(UniValue::VSTR)); |
| 770 | |
| 771 | UniValue r(UniValue::VOBJ); |
| 772 | CScript script; |
| 773 | if (params[0].get_str().size() > 0) { |
| 774 | vector<unsigned char> scriptData(ParseHexV(params[0], "argument")); |
| 775 | script = CScript(scriptData.begin(), scriptData.end()); |
| 776 | } else { |
| 777 | // Empty scripts are valid |
| 778 | } |
| 779 | ScriptPubKeyToJSON(script, r, false); |
| 780 | |
| 781 | r.push_back(Pair("p2sh", EncodeDestination(CScriptID(script)))); |
| 782 | return r; |
| 783 | } |
| 784 | |
| 785 | UniValue signrawtransaction(const UniValue& params, bool fHelp) |
| 786 | { |
nothing calls this directly
no test coverage detected