Do not use number_format for inserting to DB
This will fix an issue with very large payouts not being inserted to the DB properly. Moved number formatting to displaying output as it should be.
This commit is contained in:
parent
4c3bf8f85f
commit
8809e3df53
@ -68,7 +68,7 @@ if ($config['pps']['reward']['type'] == 'blockavg' && $block->getBlockCount() >
|
||||
}
|
||||
}
|
||||
|
||||
$pps_value = number_format(round($pps_reward / (pow(2,32) * $dDifficulty) * pow(2, $config['pps_target']), 12) ,12);
|
||||
$pps_value = round($pps_reward / (pow(2,32) * $dDifficulty) * pow(2, $config['pps_target']), 12);
|
||||
//$pps_value = number_format(round((1/(65536 * $dDifficulty) * $pps_reward), 12) ,12);
|
||||
|
||||
// Find our last share accounted and last inserted share for PPS calculations
|
||||
@ -82,7 +82,7 @@ $log->logInfo("ID\tUsername\tInvalid\tValid\t\tPPS Value\t\tPayout\t\tDonation\t
|
||||
|
||||
foreach ($aAccountShares as $aData) {
|
||||
// Take our valid shares and multiply by per share value
|
||||
$aData['payout'] = number_format(round($aData['valid'] * $pps_value, 8), 8);
|
||||
$aData['payout'] = round($aData['valid'] * $pps_value, 8);
|
||||
|
||||
// Defaults
|
||||
$aData['fee' ] = 0;
|
||||
@ -90,18 +90,18 @@ foreach ($aAccountShares as $aData) {
|
||||
|
||||
// Calculate block fees
|
||||
if ($config['fees'] > 0 && $aData['no_fees'] == 0)
|
||||
$aData['fee'] = number_format(round($config['fees'] / 100 * $aData['payout'], 8), 8);
|
||||
$aData['fee'] = round($config['fees'] / 100 * $aData['payout'], 8);
|
||||
// Calculate donation amount
|
||||
$aData['donation'] = number_format(round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8), 8);
|
||||
$aData['donation'] = round($user->getDonatePercent($user->getUserId($aData['username'])) / 100 * ( $aData['payout'] - $aData['fee']), 8);
|
||||
|
||||
$log->logInfo($aData['id'] . "\t" .
|
||||
$aData['username'] . "\t" .
|
||||
$aData['invalid'] . "\t" .
|
||||
$aData['valid'] . "\t*\t" .
|
||||
$pps_value . "\t=\t" .
|
||||
$aData['payout'] . "\t" .
|
||||
$aData['donation'] . "\t" .
|
||||
$aData['fee']);
|
||||
number_format($pps_value, 12) . "\t=\t" .
|
||||
number_format($aData['payout'], 8) . "\t" .
|
||||
number_format($aData['donation'], 8) . "\t" .
|
||||
number_format($aData['fee'], 8));
|
||||
|
||||
// Add new credit transaction
|
||||
if (!$transaction->addTransaction($aData['id'], $aData['payout'], 'Credit_PPS'))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user