Test
This commit is contained in:
@@ -1277,7 +1277,7 @@ std::string DiceBetFinish(uint8_t &funcid,uint256 &entropyused,int32_t *resultp,
|
|||||||
|
|
||||||
double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettxid,std::string &error)
|
double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettxid,std::string &error)
|
||||||
{
|
{
|
||||||
CScript fundingPubKey,scriptPubKey; CTransaction spenttx,betTx,entropyTx; uint256 hentropyproof,entropyused,hash,proof,txid,hashBlock,spenttxid,bettorentropy; CPubKey mypk,dicepk,fundingpk; struct CCcontract_info *cp,C; int32_t i,duplicate=0,result,iswin,vout,n=0; int64_t minbet,maxbet,maxodds,timeoutblocks; uint64_t sbits; char coinaddr[64]; std::string res; uint8_t funcid;
|
CScript fundingPubKey,scriptPubKey; CTransaction spenttx,betTx,entropyTx; uint256 hentropyproof,entropyused,hash,proof,txid,hashBlock,spenttxid,bettorentropy; CPubKey mypk,dicepk,fundingpk; struct CCcontract_info *cp,C; int32_t i,duplicate=0,result,iswin,vout,n=0; int64_t minbet,maxbet,maxodds,timeoutblocks,sum=0; uint64_t sbits; char coinaddr[64]; std::string res; uint8_t funcid;
|
||||||
if ( (cp= Diceinit(fundingPubKey,fundingtxid,&C,planstr,txfee,mypk,dicepk,sbits,minbet,maxbet,maxodds,timeoutblocks)) == 0 )
|
if ( (cp= Diceinit(fundingPubKey,fundingtxid,&C,planstr,txfee,mypk,dicepk,sbits,minbet,maxbet,maxodds,timeoutblocks)) == 0 )
|
||||||
{
|
{
|
||||||
error = "Diceinit error in status";
|
error = "Diceinit error in status";
|
||||||
@@ -1294,17 +1294,18 @@ double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettx
|
|||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
vout = (int32_t)it->first.index;
|
vout = (int32_t)it->first.index;
|
||||||
|
sum += it->second.satoshis;
|
||||||
if ( GetTransaction(txid,betTx,hashBlock,false) != 0 && betTx.vout.size() >= 3 && betTx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 && GetTransaction(betTx.vin[0].prevout.hash,entropyTx,hashBlock,false) != 0 )
|
if ( GetTransaction(txid,betTx,hashBlock,false) != 0 && betTx.vout.size() >= 3 && betTx.vout[vout].scriptPubKey.IsPayToCryptoCondition() != 0 && GetTransaction(betTx.vin[0].prevout.hash,entropyTx,hashBlock,false) != 0 )
|
||||||
{
|
{
|
||||||
if ( DecodeDiceOpRet(txid,betTx.vout[betTx.vout.size()-1].scriptPubKey,sbits,fundingtxid,hash,proof) == 'B' )
|
if ( DecodeDiceOpRet(txid,betTx.vout[betTx.vout.size()-1].scriptPubKey,sbits,fundingtxid,hash,proof) == 'B' )
|
||||||
{
|
{
|
||||||
duplicate = 0;
|
duplicate = 0;
|
||||||
for (i=0; i<MAX_ENTROPYUSED; i++)
|
/*for (i=0; i<MAX_ENTROPYUSED; i++)
|
||||||
if ( bettxids[i] == txid )
|
if ( bettxids[i] == txid )
|
||||||
{
|
{
|
||||||
duplicate = 1;
|
duplicate = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}*/
|
||||||
if ( duplicate == 0 )
|
if ( duplicate == 0 )
|
||||||
{
|
{
|
||||||
CSpentIndexKey key(txid, 0);
|
CSpentIndexKey key(txid, 0);
|
||||||
@@ -1334,10 +1335,12 @@ double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettx
|
|||||||
{
|
{
|
||||||
mySenddicetransaction(res,entropyused,txid,betTx,funcid);
|
mySenddicetransaction(res,entropyused,txid,betTx,funcid);
|
||||||
n++;
|
n++;
|
||||||
|
fprintf(stderr,"send ");
|
||||||
if ( n >= 1000 )
|
if ( n >= 1000 )
|
||||||
break;
|
break;
|
||||||
} //else error = res;
|
} //else error = res;
|
||||||
}
|
}
|
||||||
|
fprintf(stderr,"%d: %s/v%d (%c %.8f) %.8f\n",n,uint256_str(str,txid),vout,funcid,(double)it->second.satoshis/COIN,(double)sum/COIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user