Reduce keystrokes three

This commit is contained in:
jl777
2019-03-24 01:58:45 -11:00
parent 18c541a885
commit afa0b89400
2 changed files with 25 additions and 25 deletions

View File

@@ -136,30 +136,6 @@ UniValue games_rng(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
return(result);
}
UniValue games_events(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
{
UniValue result(UniValue::VOBJ); std::vector<uint8_t> payload; int32_t n;
if ( params != 0 && (n= cJSON_GetArraySize(params)) == 1 )
{
if ( payments_parsehexdata(payload,jitem(params,0),0) == 0 )
{
komodo_sendmessage(4,8,"events",payload);
result.push_back(Pair("result","success"));
}
else
{
result.push_back(Pair("result","error"));
result.push_back(Pair("error","couldnt parsehexdata"));
}
}
else
{
result.push_back(Pair("result","error"));
result.push_back(Pair("error","not enough params"));
}
return(result);
}
UniValue games_create(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
{
UniValue result(UniValue::VOBJ);
@@ -178,6 +154,30 @@ UniValue games_register(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
return(result);
}
UniValue games_events(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
{
UniValue result(UniValue::VOBJ); std::vector<uint8_t> payload; int32_t n;
if ( params != 0 && (n= cJSON_GetArraySize(params)) == 1 )
{
if ( payments_parsehexdata(payload,jitem(params,0),0) == 0 )
{
komodo_sendmessage(4,8,"events",payload);
result.push_back(Pair("result","success"));
}
else
{
result.push_back(Pair("result","error"));
result.push_back(Pair("error","couldnt parsehexdata"));
}
}
else
{
result.push_back(Pair("result","error"));
result.push_back(Pair("error","not enough params"));
}
return(result);
}
void komodo_netevent(std::vector<uint8_t> payload)
{
int32_t i;

View File

@@ -918,7 +918,7 @@ UniValue rogue_keystrokes(uint64_t txfee,struct CCcontract_info *cp,cJSON *param
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(),nextheight);
UniValue result(UniValue::VOBJ); CPubKey roguepk,mypk; uint256 gametxid,playertxid,batontxid; int64_t batonvalue,buyin; std::vector<uint8_t> keystrokes,playerdata; int32_t numplayers,regslot,numkeys,batonht,batonvout,n,elapsed,gameheight,maxplayers; CTransaction tx; CTxOut txout; char *keystrokestr,destaddr[64]; std::string rawtx,symbol,pname; bits256 t; uint8_t mypriv[32];
if ( txfee == 0 )
txfee = 10000;
txfee = 1000; // smaller than normal on purpose
rogue_univalue(result,"keystrokes",-1,-1);
if ( params != 0 && (n= cJSON_GetArraySize(params)) == 2 && (keystrokestr= jstr(jitem(params,1),0)) != 0 )
{