This commit is contained in:
jl777
2018-11-09 02:03:01 -11:00
parent 587d01f78a
commit 70780561e0

View File

@@ -1064,7 +1064,7 @@ int64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbit
if ( (rand() % 100) < 90 )
continue;
}
if ( myGetTransaction(txid,tx,hashBlock) != 0 && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 ) //we want consensus safe results myIsutxo_spentinmempool(txid,vout) == 0 )
if ( myGetTransaction(txid,tx,hashBlock) != 0 && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 )
{
if ( (funcid= DecodeDiceOpRet(txid,tx.vout[tx.vout.size()-1].scriptPubKey,sbits,fundingtxid,hash,proof)) != 0 && sbits == refsbits )
{
@@ -1109,12 +1109,15 @@ int64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbit
fprintf(stderr," (%c) entropy vin.%d fundingPubKey mismatch %s\n",funcid,1,uint256_str(str,tx.vin[0].prevout.hash));*/
continue;
}
entropytxid = txid;
entropyval = tx.vout[0].nValue;
//fprintf(stderr,"funcid.%c first.%d entropytxid.%s val %.8f\n",funcid,first,txid.GetHex().c_str(),(double)entropyval/COIN);
first = 1;
if (random) {
fprintf(stderr, "chosen entropy on loop: %d\n",loops);
if ( myIsutxo_spentinmempool(txid,vout) == 0 )
{
entropytxid = txid;
entropyval = tx.vout[0].nValue;
//fprintf(stderr,"funcid.%c first.%d entropytxid.%s val %.8f\n",funcid,first,txid.GetHex().c_str(),(double)entropyval/COIN);
first = 1;
if (random) {
fprintf(stderr, "chosen entropy on loop: %d\n",loops);
}
}
}
else
@@ -1339,7 +1342,7 @@ std::string DiceAddfunding(uint64_t txfee,char *planstr,uint256 fundingtxid,int6
std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet,int32_t odds)
{
CMutableTransaction mtx; CScript fundingPubKey; CPubKey mypk,dicepk; uint64_t sbits,entropyval; int64_t funding,minbet,maxbet,maxodds,timeoutblocks; uint256 entropytxid,entropy,hentropy; struct CCcontract_info *cp,C;
CMutableTransaction mtx; CScript fundingPubKey; CPubKey mypk,dicepk; uint64_t sbits,entropyval,entropyval2; int64_t funding,minbet,maxbet,maxodds,timeoutblocks; uint256 entropytxid,entropytxid2,entropy,hentropy; struct CCcontract_info *cp,C;
if ( bet < 0 )
{
CCerror = "bet must be positive";
@@ -1361,7 +1364,12 @@ std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet
}
int32_t entropytxs=0,emptyvar=0;
funding = DicePlanFunds(entropyval,entropytxid,sbits,cp,dicepk,fundingtxid,entropytxs,false);
DicePlanFunds(entropyval,entropytxid,sbits,cp,dicepk,fundingtxid,emptyvar,true);
DicePlanFunds(entropyval2,entropytxid2,sbits,cp,dicepk,fundingtxid,emptyvar,true);
if ( entropyval2 != 0 && entropytxid2 != zeroid )
{
entropyval = entropyval2;
entropytxid = entropytxid2;
}
if ( ( funding >= 2*bet*odds+txfee && entropyval != 0 ) )
{
if ( entropytxs < 100 ) {