#define GAMES_RNGMULT 11109 #define GAMES_RNGOFFSET 13849 #define GAMES_MAXRNGS 10000
This commit is contained in:
@@ -41,10 +41,10 @@ uint64_t games_rngnext(uint64_t initseed)
|
||||
seeds[1] = (initseed >> 16);
|
||||
seeds[2] = (initseed >> 32);
|
||||
seeds[3] = (initseed >> 48);
|
||||
seeds[0] = (seeds[0]*11109 + 13849);
|
||||
seeds[1] = ((seeds[0] ^ seeds[1])*11109 + 13849);
|
||||
seeds[2] = ((seeds[0] ^ seeds[1] ^ seeds[2])*11109 + 13849);
|
||||
seeds[3] = ((seeds[0] ^ seeds[1] ^ seeds[2] ^ seeds[3])*11109 + 13849);
|
||||
seeds[0] = (seeds[0]*GAMES_RNGMULT + GAMES_RNGOFFSET);
|
||||
seeds[1] = ((seeds[0] ^ seeds[1])*GAMES_RNGMULT + GAMES_RNGOFFSET);
|
||||
seeds[2] = ((seeds[0] ^ seeds[1] ^ seeds[2])*GAMES_RNGMULT + GAMES_RNGOFFSET);
|
||||
seeds[3] = ((seeds[0] ^ seeds[1] ^ seeds[2] ^ seeds[3])*GAMES_RNGMULT + GAMES_RNGOFFSET);
|
||||
return(((uint64_t)seeds[3] << 48) | ((uint64_t)seeds[2] << 24) | ((uint64_t)seeds[1] << 16) | seeds[0]);
|
||||
}
|
||||
|
||||
@@ -79,6 +79,9 @@ UniValue games_rng(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
result.push_back(Pair("playerid",(int64_t)(playerid - 1)));
|
||||
result.push_back(Pair("initseed",initseed));
|
||||
result.push_back(Pair("seed",seed));
|
||||
for (i=0; i<GAMES_MAXRNGS; i++)
|
||||
seed = games_rngnext(seed);
|
||||
result.push_back(Pair("lastseed",seed));
|
||||
result.push_back(Pair("result","success"));
|
||||
}
|
||||
else
|
||||
@@ -101,7 +104,6 @@ UniValue games_func1(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
||||
if ( AddNormalinputs(mtx,mypk,COIN+txfee,64) >= COIN+txfee ) // add utxo to mtx
|
||||
{
|
||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,amount,mypk)); // make vout0
|
||||
// add opreturn, change is automatically added and tx is properly signed
|
||||
rawtx = FinalizeCCTx(0,cp,mtx,mypk,txfee,games_opret('1',mypk));
|
||||
return(games_rawtxresult(result,rawtx,broadcastflag));
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ std::string MYCCLIBNAME = (char *)"gamescc";
|
||||
#define EVAL_GAMES (EVAL_FAUCET2+1)
|
||||
#define GAMES_TXFEE 10000
|
||||
|
||||
#define GAMES_RNGMULT 11109
|
||||
#define GAMES_RNGOFFSET 13849
|
||||
#define GAMES_MAXRNGS 10000
|
||||
|
||||
#define MYCCNAME "games"
|
||||
|
||||
#define RPC_FUNCS \
|
||||
|
||||
@@ -383,7 +383,7 @@ UniValue PaymentsRelease(struct CCcontract_info *cp,char *jsonstr)
|
||||
mtx.vout[i+1].nValue = PAYMENTS_TXFEE;
|
||||
}
|
||||
}
|
||||
if ( (inputsum= AddPaymentsInputs(cp,mtx,txidpk,newamount+2*PAYMENTS_TXFEE,60,createtxid,latestheight)) >= newamount+2*PAYMENTS_TXFEE )
|
||||
if ( (inputsum= AddPaymentsInputs(cp,mtx,txidpk,newamount+2*PAYMENTS_TXFEE,MAX_CCVINS/2,createtxid,latestheight)) >= newamount+2*PAYMENTS_TXFEE )
|
||||
{
|
||||
std::string rawtx;
|
||||
if ( (CCchange= (inputsum - newamount - 2*PAYMENTS_TXFEE)) >= PAYMENTS_TXFEE )
|
||||
|
||||
Reference in New Issue
Block a user