Fix dice finish
This commit is contained in:
@@ -970,19 +970,21 @@ std::string DiceBetFinish(int32_t *resultp,uint64_t txfee,char *planstr,uint256
|
||||
}
|
||||
CCchange = betTx.vout[0].nValue;
|
||||
fundsneeded = txfee + odds*betTx.vout[1].nValue;
|
||||
if ( CCchange >= fundsneeded+betTx.vout[1].nValue || (inputs= AddDiceInputs(cp,mtx,dicepk,fundsneeded,60,sbits,fundingtxid)) > 0 )
|
||||
if ( CCchange >= fundsneeded+betTx.vout[1].nValue )
|
||||
CCchange -= (fundsneeded + betTx.vout[1].nValue);
|
||||
else if ( (inputs= AddDiceInputs(cp,mtx,dicepk,fundsneeded,60,sbits,fundingtxid)) > 0 )
|
||||
{
|
||||
if ( inputs > fundsneeded )
|
||||
CCchange += (inputs - fundsneeded);
|
||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,CCchange,dicepk));
|
||||
mtx.vout.push_back(CTxOut(txfee,fundingPubKey));
|
||||
mtx.vout.push_back(CTxOut((odds+1) * betTx.vout[1].nValue,betTx.vout[2].scriptPubKey));
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"not enough inputs for %.8f\n",(double)fundsneeded/COIN);
|
||||
return("");
|
||||
}
|
||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,CCchange,dicepk));
|
||||
mtx.vout.push_back(CTxOut(txfee,fundingPubKey));
|
||||
mtx.vout.push_back(CTxOut((odds+1) * betTx.vout[1].nValue,betTx.vout[2].scriptPubKey));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user