return("") for std::string
This commit is contained in:
@@ -805,11 +805,11 @@ std::string DiceCreateFunding(uint64_t txfee,char *planstr,int64_t funds,int64_t
|
||||
if ( funds < 0 || minbet < 0 || maxbet < 0 || maxodds < 1 || timeoutblocks < 0 || timeoutblocks > 1440 )
|
||||
{
|
||||
fprintf(stderr,"negative parameter error\n");
|
||||
return(0);
|
||||
return("");
|
||||
}
|
||||
memset(&zero,0,sizeof(zero));
|
||||
if ( (cp= Diceinit(fundingPubKey,zero,&C,planstr,txfee,mypk,dicepk,sbits,a,b,c,d)) == 0 )
|
||||
return(0);
|
||||
return("");
|
||||
if ( AddNormalinputs(mtx,mypk,funds+3*txfee,60) > 0 )
|
||||
{
|
||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,funds,dicepk));
|
||||
@@ -818,7 +818,7 @@ std::string DiceCreateFunding(uint64_t txfee,char *planstr,int64_t funds,int64_t
|
||||
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeDiceFundingOpRet('F',sbits,minbet,maxbet,maxodds,timeoutblocks)));
|
||||
}
|
||||
fprintf(stderr,"cant find enough inputs\n");
|
||||
return(0);
|
||||
return("");
|
||||
}
|
||||
|
||||
std::string DiceAddfunding(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t amount)
|
||||
@@ -827,10 +827,10 @@ std::string DiceAddfunding(uint64_t txfee,char *planstr,uint256 fundingtxid,int6
|
||||
if ( amount < 0 )
|
||||
{
|
||||
fprintf(stderr,"negative parameter error\n");
|
||||
return(0);
|
||||
return("");
|
||||
}
|
||||
if ( (cp= Diceinit(fundingPubKey,fundingtxid,&C,planstr,txfee,mypk,dicepk,sbits,minbet,maxbet,maxodds,timeoutblocks)) == 0 )
|
||||
return(0);
|
||||
return("");
|
||||
scriptPubKey = CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG;
|
||||
if ( 0 )
|
||||
{
|
||||
@@ -854,7 +854,7 @@ std::string DiceAddfunding(uint64_t txfee,char *planstr,uint256 fundingtxid,int6
|
||||
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeDiceOpRet('E',sbits,fundingtxid,hentropy,zeroid)));
|
||||
} else fprintf(stderr,"cant find enough inputs\n");
|
||||
} else fprintf(stderr,"only fund creator can add more funds (entropy)\n");
|
||||
return(0);
|
||||
return("");
|
||||
}
|
||||
|
||||
std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet,int32_t odds)
|
||||
@@ -863,21 +863,21 @@ std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet
|
||||
if ( bet < 0 || odds < 1 )
|
||||
{
|
||||
fprintf(stderr,"negative parameter error\n");
|
||||
return(0);
|
||||
return("");
|
||||
}
|
||||
if ( (cp= Diceinit(fundingPubKey,fundingtxid,&C,planstr,txfee,mypk,dicepk,sbits,minbet,maxbet,maxodds,timeoutblocks)) == 0 )
|
||||
return(0);
|
||||
return("");
|
||||
if ( bet < minbet || bet > maxbet || odds > maxodds )
|
||||
{
|
||||
fprintf(stderr,"Dice plan %s illegal bet %.8f: minbet %.8f maxbet %.8f or odds %d vs max.%d\n",planstr,(double)bet/COIN,(double)minbet/COIN,(double)maxbet/COIN,(int32_t)odds,(int32_t)maxodds);
|
||||
return(0);
|
||||
return("");
|
||||
}
|
||||
if ( (funding= DicePlanFunds(entropyval,entropytxid,sbits,cp,dicepk,fundingtxid)) >= 2*bet*odds+txfee && entropyval != 0 )
|
||||
{
|
||||
if ( myIsutxo_spentinmempool(entropytxid,0) != 0 )
|
||||
{
|
||||
fprintf(stderr,"entropy txid is spent\n");
|
||||
return(0);
|
||||
return("");
|
||||
}
|
||||
mtx.vin.push_back(CTxIn(entropytxid,0,CScript()));
|
||||
if ( AddNormalinputs(mtx,mypk,bet+2*txfee+odds,60) > 0 )
|
||||
@@ -892,7 +892,7 @@ std::string DiceBet(uint64_t txfee,char *planstr,uint256 fundingtxid,int64_t bet
|
||||
if ( entropyval == 0 && funding != 0 )
|
||||
fprintf(stderr,"cant find dice entropy inputs\n");
|
||||
else fprintf(stderr,"cant find dice inputs\n");
|
||||
return(0);
|
||||
return("");
|
||||
}
|
||||
|
||||
std::string DiceBetFinish(int32_t *resultp,uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettxid,int32_t winlosetimeout)
|
||||
@@ -903,7 +903,7 @@ std::string DiceBetFinish(int32_t *resultp,uint64_t txfee,char *planstr,uint256
|
||||
if ( (cp= Diceinit(fundingPubKey,fundingtxid,&C,planstr,txfee,mypk,dicepk,sbits,minbet,maxbet,maxodds,timeoutblocks)) == 0 )
|
||||
{
|
||||
fprintf(stderr,"Diceinit error\n");
|
||||
return("0");
|
||||
return("");
|
||||
}
|
||||
fundingpk = DiceFundingPk(fundingPubKey);
|
||||
if ( winlosetimeout != 0 )
|
||||
@@ -918,7 +918,7 @@ std::string DiceBetFinish(int32_t *resultp,uint64_t txfee,char *planstr,uint256
|
||||
if ( AddNormalinputs(mtx,mypk,txfee,1) == 0 )
|
||||
{
|
||||
fprintf(stderr,"no txfee inputs for win/lose\n");
|
||||
return("0");
|
||||
return("");
|
||||
}
|
||||
if ( GetTransaction(bettxid,betTx,hashBlock,false) != 0 && GetTransaction(betTx.vin[0].prevout.hash,entropyTx,hashBlock,false) != 0 )
|
||||
{
|
||||
@@ -932,7 +932,7 @@ std::string DiceBetFinish(int32_t *resultp,uint64_t txfee,char *planstr,uint256
|
||||
if ( myIsutxo_spentinmempool(bettxid,0) != 0 || myIsutxo_spentinmempool(bettxid,1) != 0 )
|
||||
{
|
||||
fprintf(stderr,"bettxid already spent\n");
|
||||
return("0");
|
||||
return("");
|
||||
}
|
||||
//fprintf(stderr,"iswin.%d matches\n",iswin);
|
||||
mtx.vin.push_back(CTxIn(bettxid,0,CScript()));
|
||||
@@ -942,7 +942,7 @@ std::string DiceBetFinish(int32_t *resultp,uint64_t txfee,char *planstr,uint256
|
||||
funcid = 'T';
|
||||
if ( DiceVerifyTimeout(betTx,timeoutblocks) == 0 ) // hasnt timed out yet
|
||||
{
|
||||
return("0");
|
||||
return("");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -958,7 +958,7 @@ std::string DiceBetFinish(int32_t *resultp,uint64_t txfee,char *planstr,uint256
|
||||
if ( odds < 1 || odds > maxodds )
|
||||
{
|
||||
fprintf(stderr,"illegal odds.%d vs maxodds.%d\n",(int32_t)odds,(int32_t)maxodds);
|
||||
return("0");
|
||||
return("");
|
||||
}
|
||||
CCchange = betTx.vout[0].nValue;
|
||||
fundsneeded = txfee + odds*betTx.vout[1].nValue;
|
||||
@@ -973,7 +973,7 @@ std::string DiceBetFinish(int32_t *resultp,uint64_t txfee,char *planstr,uint256
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"not enough inputs for %.8f\n",(double)fundsneeded/COIN);
|
||||
return("0");
|
||||
return("");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -994,12 +994,12 @@ std::string DiceBetFinish(int32_t *resultp,uint64_t txfee,char *planstr,uint256
|
||||
{
|
||||
*resultp = -1;
|
||||
fprintf(stderr,"iswin.%d winlosetimeout.%d\n",iswin,winlosetimeout);
|
||||
return("0");
|
||||
return("");
|
||||
}
|
||||
}
|
||||
*resultp = -1;
|
||||
fprintf(stderr,"couldnt find bettx or entropytx\n");
|
||||
return("0");
|
||||
return("");
|
||||
}
|
||||
|
||||
double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettxid)
|
||||
|
||||
Reference in New Issue
Block a user