Merge remote-tracking branch 'origin/jl777' into cctests

This commit is contained in:
Jonathan "Duke" Leto
2018-08-22 09:26:53 +02:00
2 changed files with 15 additions and 5 deletions

View File

@@ -257,9 +257,15 @@ uint64_t DiceCalc(int64_t bet,int64_t odds,int64_t minbet,int64_t maxbet,int64_t
winnings = 0;
if ( odds > 1 )
{
if ( 0 )
{ // old way
bettor = (bettor / arith_uint256(odds));
if ( bettor >= house )
winnings = bet * (odds+1);
return(winnings);
}
if ( odds > 9999 ) // shouldnt happen
return(0);
//bettor = (bettor / arith_uint256(odds));
endiancpy(buf,(uint8_t *)&house,32);
endiancpy(&buf[32],(uint8_t *)&bettor,32);
vcalc_sha256(0,(uint8_t *)&_hash,buf,64);
@@ -851,7 +857,7 @@ UniValue DiceList()
std::string DiceCreateFunding(uint64_t txfee,char *planstr,int64_t funds,int64_t minbet,int64_t maxbet,int64_t maxodds,int64_t timeoutblocks)
{
CMutableTransaction mtx; uint256 zero; CScript fundingPubKey; CPubKey mypk,dicepk; int64_t a,b,c,d; uint64_t sbits; struct CCcontract_info *cp,C;
if ( funds < 0 || minbet < 0 || maxbet < 0 || maxodds < 1 || timeoutblocks < 0 || timeoutblocks > 1440 )
if ( funds < 0 || minbet < 0 || maxbet < 0 || maxodds < 1 || maxodds > 9999 || timeoutblocks < 0 || timeoutblocks > 1440 )
{
fprintf(stderr,"negative parameter error\n");
return("");
@@ -873,9 +879,9 @@ std::string DiceCreateFunding(uint64_t txfee,char *planstr,int64_t funds,int64_t
std::string DiceAddfunding(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t amount)
{
CMutableTransaction mtx; CScript fundingPubKey,scriptPubKey; uint256 entropy,hentropy; CPubKey mypk,dicepk; uint64_t sbits; struct CCcontract_info *cp,C; int64_t minbet,maxbet,maxodds,timeoutblocks;
if ( amount < 0 || maxodds < 1 || maxodds > 9999 )
if ( amount < 0 )
{
fprintf(stderr,"negative parameter or invalid maxodds error (limit 9999)\n");
fprintf(stderr,"negative parameter\n");
return("");
}
if ( (cp= Diceinit(fundingPubKey,fundingtxid,&C,planstr,txfee,mypk,dicepk,sbits,minbet,maxbet,maxodds,timeoutblocks)) == 0 )

View File

@@ -4184,8 +4184,12 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
rejects++;
}
if ( rejects == 0 || rejects == lastrejects )
{
if ( lastrejects != 0 )
fprintf(stderr,"lastrejects.%d -> all tx in mempool\n",lastrejects);
break;
fprintf(stderr,"addtomempool for CC checking: n.%d rejects.%d last.%d\n",(int32_t)block.vtx.size(),rejects,lastrejects);
}
fprintf(stderr,"addtomempool ht.%d for CC checking: n.%d rejects.%d last.%d\n",height,(int32_t)block.vtx.size(),rejects,lastrejects);
lastrejects = rejects;
rejects = 0;
}