Test
This commit is contained in:
@@ -1001,7 +1001,7 @@ std::string DiceBetFinish(int32_t *resultp,uint64_t txfee,char *planstr,uint256
|
|||||||
|
|
||||||
double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettxid)
|
double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettxid)
|
||||||
{
|
{
|
||||||
CScript fundingPubKey,scriptPubKey; CTransaction spenttx,betTx; uint256 hash,proof,txid,hashBlock,spenttxid; CPubKey mypk,dicepk,fundingpk; struct CCcontract_info *cp,C; int32_t result,vout; int64_t minbet,maxbet,maxodds,timeoutblocks; uint64_t sbits; char coinaddr[64]; std::string res;
|
CScript fundingPubKey,scriptPubKey; CTransaction spenttx,betTx; uint256 hash,proof,txid,hashBlock,spenttxid; CPubKey mypk,dicepk,fundingpk; struct CCcontract_info *cp,C; int32_t result,vout,n=0; int64_t minbet,maxbet,maxodds,timeoutblocks; uint64_t sbits; char coinaddr[64]; std::string res;
|
||||||
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 )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"Diceinit error\n");
|
fprintf(stderr,"Diceinit error\n");
|
||||||
@@ -1024,10 +1024,14 @@ double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettx
|
|||||||
{
|
{
|
||||||
res = DiceBetFinish(&result,txfee,planstr,fundingtxid,txid,1);
|
res = DiceBetFinish(&result,txfee,planstr,fundingtxid,txid,1);
|
||||||
if ( result > 0 )
|
if ( result > 0 )
|
||||||
|
{
|
||||||
mySendrawtransaction(res);
|
mySendrawtransaction(res);
|
||||||
|
n++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return(n);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5279,8 +5279,16 @@ UniValue dicestatus(const UniValue& params, bool fHelp)
|
|||||||
{
|
{
|
||||||
if ( winnings > 0. )
|
if ( winnings > 0. )
|
||||||
{
|
{
|
||||||
result.push_back(Pair("status", "win"));
|
if ( params.size() == 3 )
|
||||||
result.push_back(Pair("won", winnings));
|
{
|
||||||
|
result.push_back(Pair("status", "win"));
|
||||||
|
result.push_back(Pair("won", winnings));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.push_back(Pair("status", "finalized"));
|
||||||
|
result.push_back(Pair("n", (int64_t)winnings));
|
||||||
|
}
|
||||||
} else result.push_back(Pair("status", "loss"));
|
} else result.push_back(Pair("status", "loss"));
|
||||||
} else result.push_back(Pair("status", "invalid bet txid"));
|
} else result.push_back(Pair("status", "invalid bet txid"));
|
||||||
return(result);
|
return(result);
|
||||||
|
|||||||
Reference in New Issue
Block a user