Delete more CCs #381
This commit is contained in:
@@ -1508,71 +1508,6 @@ UniValue txnotarizedconfirmed(const UniValue& params, bool fHelp, const CPubKey&
|
||||
return result;
|
||||
}
|
||||
|
||||
UniValue decodeccopret(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
||||
{
|
||||
CTransaction tx; uint256 tokenid,txid,hashblock;
|
||||
std::vector<uint8_t> vopret,vOpretExtra; uint8_t *script,tokenevalcode;
|
||||
UniValue result(UniValue::VOBJ),array(UniValue::VARR); std::vector<CPubKey> pubkeys;
|
||||
|
||||
if (fHelp || params.size() < 1 || params.size() > 1)
|
||||
{
|
||||
string msg = "decodeccopret scriptPubKey\n"
|
||||
"\nReturns eval code and function id for CC OP RETURN data.\n"
|
||||
|
||||
"\nArguments:\n"
|
||||
"1. scriptPubKey (string, required) Hex of scriptPubKey with OP_RETURN data.\n"
|
||||
|
||||
"\nResult:\n"
|
||||
"{\n"
|
||||
" eval_code, (string) Eval code name.\n"
|
||||
" function, (char) Function id char.\n"
|
||||
"}\n"
|
||||
;
|
||||
throw runtime_error(msg);
|
||||
}
|
||||
std::vector<unsigned char> hex(ParseHex(params[0].get_str()));
|
||||
CScript scripthex(hex.begin(),hex.end());
|
||||
std::vector<std::pair<uint8_t, vscript_t>> oprets;
|
||||
if (DecodeTokenOpRet(scripthex,tokenevalcode,tokenid,pubkeys, oprets)!=0 && tokenevalcode==EVAL_TOKENS && oprets.size()>0)
|
||||
{
|
||||
// seems we need a loop here
|
||||
vOpretExtra = oprets[0].second;
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
GetOpReturnData(scripthex,vopret);
|
||||
script = (uint8_t *)vopret.data();
|
||||
if ( vopret.size() > 1)
|
||||
{
|
||||
char func[5];
|
||||
sprintf(func,"%c",script[1]);
|
||||
obj.push_back(Pair("eval_code", EvalToStr(script[0])));
|
||||
obj.push_back(Pair("function", func));
|
||||
}
|
||||
else
|
||||
{
|
||||
obj.push_back(Pair("error", "invalid or no CC opret data for Token OP_RETURN"));
|
||||
}
|
||||
array.push_back(obj);
|
||||
if (!E_UNMARSHAL(vOpretExtra, { ss >> vopret; })) return (0);
|
||||
}
|
||||
else GetOpReturnData(scripthex,vopret);
|
||||
script = (uint8_t *)vopret.data();
|
||||
if ( vopret.size() > 1)
|
||||
{
|
||||
char func[5]; UniValue obj(UniValue::VOBJ);
|
||||
result.push_back(Pair("result", "success"));
|
||||
sprintf(func,"%c",script[1]);
|
||||
obj.push_back(Pair("eval_code", EvalToStr(script[0])));
|
||||
obj.push_back(Pair("function", func));
|
||||
array.push_back(obj);
|
||||
result.push_back(Pair("OpRets",array));
|
||||
}
|
||||
else
|
||||
{
|
||||
result.push_back(Pair("result", "error"));
|
||||
result.push_back(Pair("error", "invalid or no CC opret data"));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static const CRPCCommand commands[] =
|
||||
{ // category name actor (function) okSafeMode
|
||||
|
||||
Reference in New Issue
Block a user