MCPcopy Create free account
hub / github.com/LUX-Core/lux / decodescript

Function decodescript

src/rpcrawtransaction.cpp:744–783  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

742}
743
744UniValue 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
785UniValue signrawtransaction(const UniValue& params, bool fHelp)
786{

Callers

nothing calls this directly

Calls 14

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
RPCTypeCheckFunction · 0.85
ParseHexVFunction · 0.85
ScriptPubKeyToJSONFunction · 0.85
PairFunction · 0.85
EncodeDestinationFunction · 0.85
get_strMethod · 0.80
CScriptClass · 0.70
CScriptIDClass · 0.70
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected