Test
This commit is contained in:
@@ -1064,7 +1064,7 @@ int64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbit
|
|||||||
if ( (rand() % 100) < 90 )
|
if ( (rand() % 100) < 90 )
|
||||||
continue;
|
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 )
|
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));*/
|
fprintf(stderr," (%c) entropy vin.%d fundingPubKey mismatch %s\n",funcid,1,uint256_str(str,tx.vin[0].prevout.hash));*/
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
entropytxid = txid;
|
if ( myIsutxo_spentinmempool(txid,vout) == 0 )
|
||||||
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);
|
entropytxid = txid;
|
||||||
first = 1;
|
entropyval = tx.vout[0].nValue;
|
||||||
if (random) {
|
//fprintf(stderr,"funcid.%c first.%d entropytxid.%s val %.8f\n",funcid,first,txid.GetHex().c_str(),(double)entropyval/COIN);
|
||||||
fprintf(stderr, "chosen entropy on loop: %d\n",loops);
|
first = 1;
|
||||||
|
if (random) {
|
||||||
|
fprintf(stderr, "chosen entropy on loop: %d\n",loops);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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)
|
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 )
|
if ( bet < 0 )
|
||||||
{
|
{
|
||||||
CCerror = "bet must be positive";
|
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;
|
int32_t entropytxs=0,emptyvar=0;
|
||||||
funding = DicePlanFunds(entropyval,entropytxid,sbits,cp,dicepk,fundingtxid,entropytxs,false);
|
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 ( ( funding >= 2*bet*odds+txfee && entropyval != 0 ) )
|
||||||
{
|
{
|
||||||
if ( entropytxs < 100 ) {
|
if ( entropytxs < 100 ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user