Fix dice finish
This commit is contained in:
@@ -968,7 +968,7 @@ std::string DiceBetFinish(int32_t *resultp,uint64_t txfee,char *planstr,uint256
|
|||||||
fprintf(stderr,"illegal odds.%d vs maxodds.%d\n",(int32_t)odds,(int32_t)maxodds);
|
fprintf(stderr,"illegal odds.%d vs maxodds.%d\n",(int32_t)odds,(int32_t)maxodds);
|
||||||
return("");
|
return("");
|
||||||
}
|
}
|
||||||
CCchange = betTx.vout[0].nValue;
|
CCchange = betTx.vout[0].nValue + betTx.vout[1];
|
||||||
fundsneeded = txfee + odds*betTx.vout[1].nValue;
|
fundsneeded = txfee + odds*betTx.vout[1].nValue;
|
||||||
if ( CCchange >= fundsneeded+betTx.vout[1].nValue )
|
if ( CCchange >= fundsneeded+betTx.vout[1].nValue )
|
||||||
CCchange -= (fundsneeded + betTx.vout[1].nValue);
|
CCchange -= (fundsneeded + betTx.vout[1].nValue);
|
||||||
|
|||||||
@@ -1327,14 +1327,16 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he
|
|||||||
ave = (sum / arith_uint256(m));
|
ave = (sum / arith_uint256(m));
|
||||||
if ( ave > target )
|
if ( ave > target )
|
||||||
ave = target;
|
ave = target;
|
||||||
} else ave = easydiff; //else return(target);
|
} else ave = target; //easydiff; //else return(target);
|
||||||
if ( percPoS == 0 )
|
if ( percPoS == 0 )
|
||||||
percPoS = 1;
|
percPoS = 1;
|
||||||
if ( percPoS < goalperc ) // increase PoW diff -> lower bnTarget
|
if ( percPoS < goalperc ) // increase PoW diff -> lower bnTarget
|
||||||
{
|
{
|
||||||
|
//if ( oldflag != 0 )
|
||||||
|
// bnTarget = (ave * arith_uint256(percPoS * percPoS)) / arith_uint256(goalperc * goalperc * goalperc);
|
||||||
if ( oldflag != 0 )
|
if ( oldflag != 0 )
|
||||||
bnTarget = (ave * arith_uint256(percPoS * percPoS)) / arith_uint256(goalperc * goalperc * goalperc);
|
bnTarget = (ave / arith_uint256(goalperc * goalperc * goalperc)) * arith_uint256(percPoS * percPoS);
|
||||||
else bnTarget = (ave / arith_uint256(goalperc * goalperc * goalperc)) * arith_uint256(percPoS * percPoS);
|
else bnTarget = (ave / arith_uint256(goalperc * goalperc * goalperc * goalperc)) * arith_uint256(percPoS * percPoS);
|
||||||
if ( ASSETCHAINS_STAKED < 100 )
|
if ( ASSETCHAINS_STAKED < 100 )
|
||||||
{
|
{
|
||||||
for (i=31; i>=24; i--)
|
for (i=31; i>=24; i--)
|
||||||
@@ -1355,7 +1357,8 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he
|
|||||||
bnTarget = ((ave * arith_uint256(goalperc)) + (easydiff * arith_uint256(percPoS))) / arith_uint256(percPoS + goalperc);
|
bnTarget = ((ave * arith_uint256(goalperc)) + (easydiff * arith_uint256(percPoS))) / arith_uint256(percPoS + goalperc);
|
||||||
//bnTarget = (bnTarget * arith_uint256(percPoS * percPoS * percPoS)) / arith_uint256(goalperc * goalperc);
|
//bnTarget = (bnTarget * arith_uint256(percPoS * percPoS * percPoS)) / arith_uint256(goalperc * goalperc);
|
||||||
bnTarget = (bnTarget / arith_uint256(goalperc * goalperc)) * arith_uint256(percPoS * percPoS * percPoS);
|
bnTarget = (bnTarget / arith_uint256(goalperc * goalperc)) * arith_uint256(percPoS * percPoS * percPoS);
|
||||||
} else bnTarget = (ave / arith_uint256(goalperc * goalperc)) * arith_uint256(percPoS * percPoS * percPoS);
|
}
|
||||||
|
else bnTarget = (ave / arith_uint256(goalperc * goalperc)) * arith_uint256(percPoS * percPoS * percPoS);
|
||||||
if ( bnTarget > easydiff )
|
if ( bnTarget > easydiff )
|
||||||
bnTarget = easydiff;
|
bnTarget = easydiff;
|
||||||
else if ( bnTarget < ave ) // overflow
|
else if ( bnTarget < ave ) // overflow
|
||||||
|
|||||||
Reference in New Issue
Block a user