diff --git a/include/classes/block.class.php b/include/classes/block.class.php index cf0ea7eeb..c32bab24a 100644 --- a/include/classes/block.class.php +++ b/include/classes/block.class.php @@ -237,7 +237,7 @@ public function setShareId($block_id, $share_id) { * @return bool **/ public function setShares($block_id, $shares=NULL) { - $field = array( 'name' => 'shares', 'value' => $shares, 'type' => 'i'); + $field = array( 'name' => 'shares', 'value' => $shares, 'type' => 'd'); return $this->updateSingle($block_id, $field); } diff --git a/include/classes/coins/coin_base.class.php b/include/classes/coins/coin_base.class.php index 035939d1e..efa1d5e89 100644 --- a/include/classes/coins/coin_base.class.php +++ b/include/classes/coins/coin_base.class.php @@ -60,7 +60,7 @@ public function calcHashrate($shares, $interval) { * according to our configuration difficulty **/ public function calcEstaimtedShares($dDifficulty) { - return (int)round(pow(2, (32 - $this->target_bits)) * $dDifficulty, 0); + return (float)round(pow(2, (32 - $this->target_bits)) * $dDifficulty, $this->share_difficulty_precision); } /** diff --git a/include/classes/statistics.class.php b/include/classes/statistics.class.php index 05c2c2ac8..bd7984541 100644 --- a/include/classes/statistics.class.php +++ b/include/classes/statistics.class.php @@ -111,7 +111,7 @@ public function getBlocksFound($limit=10) { b.*, a.username AS finder, a.is_anonymous AS is_anonymous, - ROUND(difficulty * POW(2, 32 - " . $this->coin->getTargetBits() . "), 0) AS estshares + ROUND(difficulty * POW(2, 32 - " . $this->coin->getTargetBits() . "), " . $this->coin->getShareDifficultyPrecision() . ") AS estshares FROM " . $this->block->getTableName() . " AS b LEFT JOIN " . $this->user->getTableName() . " AS a ON b.account_id = a.id @@ -261,12 +261,12 @@ public function getCurrentShareRate($interval=180) { SELECT ( ( - SELECT ROUND(SUM(difficulty) / ?, 2) AS sharerate + SELECT ROUND(SUM(difficulty) / ?, " . $this->coin->getShareDifficultyPrecision() . ") AS sharerate FROM " . $this->share->getTableName() . " WHERE time > DATE_SUB(now(), INTERVAL ? SECOND) AND our_result = 'Y' ) + ( - SELECT ROUND(SUM(difficulty) / ?, 2) AS sharerate + SELECT ROUND(SUM(difficulty) / ?, " . $this->coin->getShareDifficultyPrecision() . ") AS sharerate FROM " . $this->share->getArchiveTableName() . " WHERE time > DATE_SUB(now(), INTERVAL ? SECOND) AND our_result = 'Y' diff --git a/include/classes/worker.class.php b/include/classes/worker.class.php index f2236b04e..bcb3c5818 100644 --- a/include/classes/worker.class.php +++ b/include/classes/worker.class.php @@ -174,7 +174,7 @@ public function getWorkers($account_id, $interval=600) { while ($row = $result->fetch_assoc()) { $row['hashrate'] = round($this->coin->calcHashrate($row['shares'], $interval), 2); if ($row['count_all'] > 0) { - $row['difficulty'] = round($row['shares'] / $row['count_all'], 2); + $row['difficulty'] = round($row['shares'] / $row['count_all'], $this->coin->getShareDifficultyPrecision()); } else { $row['difficulty'] = 0.00; } diff --git a/sql/000_base_structure.sql b/sql/000_base_structure.sql index a5c55b10d..5f7a33433 100644 --- a/sql/000_base_structure.sql +++ b/sql/000_base_structure.sql @@ -43,7 +43,7 @@ CREATE TABLE IF NOT EXISTS `blocks` ( `accounted` tinyint(1) NOT NULL DEFAULT '0', `account_id` int(255) unsigned DEFAULT NULL, `worker_name` varchar(50) DEFAULT 'unknown', - `shares` bigint(30) unsigned DEFAULT NULL, + `shares` double unsigned DEFAULT NULL, `share_id` bigint(30) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `height` (`height`,`blockhash`), @@ -182,10 +182,10 @@ CREATE TABLE IF NOT EXISTS `statistics_shares` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `account_id` int(10) unsigned NOT NULL, `block_id` int(10) unsigned NOT NULL, - `valid` float NOT NULL DEFAULT '0', - `invalid` float NOT NULL DEFAULT '0', - `pplns_valid` float NOT NULL DEFAULT '0', - `pplns_invalid` float NOT NULL DEFAULT '0', + `valid` float unsigned NOT NULL DEFAULT '0', + `invalid` float unsigned NOT NULL DEFAULT '0', + `pplns_valid` float unsigned NOT NULL DEFAULT '0', + `pplns_invalid` float unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `account_id` (`account_id`), KEY `block_id` (`block_id`) diff --git a/templates/bootstrap/dashboard/blocks/default.tpl b/templates/bootstrap/dashboard/blocks/default.tpl index d947f5378..5db6b5028 100644 --- a/templates/bootstrap/dashboard/blocks/default.tpl +++ b/templates/bootstrap/dashboard/blocks/default.tpl @@ -26,8 +26,8 @@ {$BLOCKSFOUND[block].time|date_format:$GLOBAL.config.date} {$BLOCKSFOUND[block].difficulty|number_format:"4"} {$BLOCKSFOUND[block].amount|number_format:"2"} - {$BLOCKSFOUND[block].estshares|number_format} - {$BLOCKSFOUND[block].shares|number_format} + {$BLOCKSFOUND[block].estshares|number_format:$GLOBAL.config.sharediffprecision} + {$BLOCKSFOUND[block].shares|number_format:$GLOBAL.config.sharediffprecision} {math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares|default:"0" estshares=$BLOCKSFOUND[block].estshares} {$percentage|number_format:"2"} @@ -46,4 +46,4 @@ {/if} -{/if} \ No newline at end of file +{/if} diff --git a/templates/bootstrap/dashboard/js/api.tpl b/templates/bootstrap/dashboard/js/api.tpl index 972869add..79db539b9 100644 --- a/templates/bootstrap/dashboard/js/api.tpl +++ b/templates/bootstrap/dashboard/js/api.tpl @@ -43,7 +43,7 @@ $(document).ready(function(){ // Load initial sparkline values var storedPersonalHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.userdata.hashrate|round:"2"}{literal} ]; - var storedPersonalSharerate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.userdata.sharerate|round:"2"}{literal} ]; + var storedPersonalSharerate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.userdata.sharerate|round:$GLOBAL.config.sharediffprecision}{literal} ]; var storedPoolHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.hashrate|round:"2"}{literal} ]; var storedNetHashrate = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.nethashrate|round:"2"}{literal} ]; var storedPoolWorkers = [ null, null, null, null, null, null, null, null, null, null, null, null, {/literal}{$GLOBAL.workers}{literal} ]; @@ -89,7 +89,7 @@ $(document).ready(function(){ storedPersonalHashrate.shift(); storedPersonalHashrate.push(parseFloat(data.getdashboarddata.data.personal.hashrate).toFixed(2)) storedPersonalSharerate.shift(); - storedPersonalSharerate.push(parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed(2)) + storedPersonalSharerate.push(parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed({/literal}{$GLOBAL.config.sharediffprecision}{literal})) storedPoolHashrate.shift(); storedPoolHashrate.push(parseFloat(data.getdashboarddata.data.pool.hashrate).toFixed(2)) storedNetHashrate.shift(); @@ -122,7 +122,7 @@ $(document).ready(function(){ } else { $('#b-nethashrate').html('n/a'); } - $('#b-sharerate').html((parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed(2))); + $('#b-sharerate').html((parseFloat(data.getdashboarddata.data.personal.sharerate).toFixed({/literal}{$GLOBAL.config.sharediffprecision}{literal}))); $('#b-yvalid').html(number_format(data.getdashboarddata.data.personal.shares.valid, {/literal}{$GLOBAL.config.sharediffprecision}{literal})); $('#b-yivalid').html(number_format(data.getdashboarddata.data.personal.shares.invalid, {/literal}{$GLOBAL.config.sharediffprecision}{literal})); if ( data.getdashboarddata.data.personal.shares.valid > 0 ) { diff --git a/templates/bootstrap/dashboard/overview/_with_price_graph.tpl b/templates/bootstrap/dashboard/overview/_with_price_graph.tpl index 7f2a6e44e..6546b681c 100644 --- a/templates/bootstrap/dashboard/overview/_with_price_graph.tpl +++ b/templates/bootstrap/dashboard/overview/_with_price_graph.tpl @@ -43,7 +43,7 @@

My Sharerate

- {$GLOBAL.userdata.sharerate|number_format:"2"} + {$GLOBAL.userdata.sharerate|number_format:$GLOBAL.config.sharediffprecision} S/s
diff --git a/templates/bootstrap/dashboard/overview/_without_price_graph.tpl b/templates/bootstrap/dashboard/overview/_without_price_graph.tpl index 5ccbe0f54..31e58ebe1 100644 --- a/templates/bootstrap/dashboard/overview/_without_price_graph.tpl +++ b/templates/bootstrap/dashboard/overview/_without_price_graph.tpl @@ -43,7 +43,7 @@

My Sharerate

- {$GLOBAL.userdata.sharerate|number_format:"2"} + {$GLOBAL.userdata.sharerate|number_format:$GLOBAL.config.sharediffprecision} S/s
diff --git a/templates/bootstrap/dashboard/round_statistics/prop/round.tpl b/templates/bootstrap/dashboard/round_statistics/prop/round.tpl index 8ea54a2e9..7338471f0 100644 --- a/templates/bootstrap/dashboard/round_statistics/prop/round.tpl +++ b/templates/bootstrap/dashboard/round_statistics/prop/round.tpl @@ -70,7 +70,7 @@

{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}

-

Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}

+

Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget|default:2016 > 1}{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}

diff --git a/templates/bootstrap/statistics/blocks/block_overview_time.tpl b/templates/bootstrap/statistics/blocks/block_overview_time.tpl index 7fb9941bc..38823285a 100644 --- a/templates/bootstrap/statistics/blocks/block_overview_time.tpl +++ b/templates/bootstrap/statistics/blocks/block_overview_time.tpl @@ -38,8 +38,8 @@ 0 {/if} - {$LASTBLOCKSBYTIME.TotalEstimatedShares|number_format} - {$LASTBLOCKSBYTIME.TotalShares|number_format} + {$LASTBLOCKSBYTIME.TotalEstimatedShares|number_format:$GLOBAL.config.sharediffprecision} + {$LASTBLOCKSBYTIME.TotalShares|number_format:$GLOBAL.config.sharediffprecision} {if $LASTBLOCKSBYTIME.TotalEstimatedShares > 0} {($LASTBLOCKSBYTIME.TotalShares / $LASTBLOCKSBYTIME.TotalEstimatedShares * 100)|number_format:"2"}% @@ -64,8 +64,8 @@ 0 {/if} - {$LASTBLOCKSBYTIME.1HourEstimatedShares|number_format} - {$LASTBLOCKSBYTIME.1HourShares|number_format} + {$LASTBLOCKSBYTIME.1HourEstimatedShares|number_format:$GLOBAL.config.sharediffprecision} + {$LASTBLOCKSBYTIME.1HourShares|number_format:$GLOBAL.config.sharediffprecision} {if $LASTBLOCKSBYTIME.1HourEstimatedShares > 0} {($LASTBLOCKSBYTIME.1HourShares / $LASTBLOCKSBYTIME.1HourEstimatedShares * 100)|number_format:"2"}% @@ -90,8 +90,8 @@ 0 {/if} - {$LASTBLOCKSBYTIME.24HourEstimatedShares|number_format} - {$LASTBLOCKSBYTIME.24HourShares|number_format} + {$LASTBLOCKSBYTIME.24HourEstimatedShares|number_format:$GLOBAL.config.sharediffprecision} + {$LASTBLOCKSBYTIME.24HourShares|number_format:$GLOBAL.config.sharediffprecision} {if $LASTBLOCKSBYTIME.24HourEstimatedShares > 0} {($LASTBLOCKSBYTIME.24HourShares / $LASTBLOCKSBYTIME.24HourEstimatedShares * 100)|number_format:"2"}% @@ -116,8 +116,8 @@ 0 {/if} - {$LASTBLOCKSBYTIME.7DaysEstimatedShares|number_format} - {$LASTBLOCKSBYTIME.7DaysShares|number_format} + {$LASTBLOCKSBYTIME.7DaysEstimatedShares|number_format:$GLOBAL.config.sharediffprecision} + {$LASTBLOCKSBYTIME.7DaysShares|number_format:$GLOBAL.config.sharediffprecision} {if $LASTBLOCKSBYTIME.7DaysEstimatedShares > 0} {($LASTBLOCKSBYTIME.7DaysShares / $LASTBLOCKSBYTIME.7DaysEstimatedShares * 100)|number_format:"2"}% @@ -142,8 +142,8 @@ 0 {/if} - {$LASTBLOCKSBYTIME.4WeeksEstimatedShares|number_format} - {$LASTBLOCKSBYTIME.4WeeksShares|number_format} + {$LASTBLOCKSBYTIME.4WeeksEstimatedShares|number_format:$GLOBAL.config.sharediffprecision} + {$LASTBLOCKSBYTIME.4WeeksShares|number_format:$GLOBAL.config.sharediffprecision} {if $LASTBLOCKSBYTIME.4WeeksEstimatedShares > 0} {($LASTBLOCKSBYTIME.4WeeksShares / $LASTBLOCKSBYTIME.4WeeksEstimatedShares * 100)|number_format:"2"}% @@ -168,8 +168,8 @@ 0 {/if} - {$LASTBLOCKSBYTIME.12MonthEstimatedShares|number_format} - {$LASTBLOCKSBYTIME.12MonthShares|number_format} + {$LASTBLOCKSBYTIME.12MonthEstimatedShares|number_format:$GLOBAL.config.sharediffprecision} + {$LASTBLOCKSBYTIME.12MonthShares|number_format:$GLOBAL.config.sharediffprecision} {if $LASTBLOCKSBYTIME.12MonthEstimatedShares > 0} {($LASTBLOCKSBYTIME.12MonthShares / $LASTBLOCKSBYTIME.12MonthEstimatedShares * 100)|number_format:"2"}% diff --git a/templates/bootstrap/statistics/blocks/blocks_found_details.tpl b/templates/bootstrap/statistics/blocks/blocks_found_details.tpl index 1f054a864..ff0aad4a7 100644 --- a/templates/bootstrap/statistics/blocks/blocks_found_details.tpl +++ b/templates/bootstrap/statistics/blocks/blocks_found_details.tpl @@ -51,12 +51,12 @@ {$BLOCKSFOUND[block].amount|number_format:"2"} {assign var="totalexpectedshares" value=$totalexpectedshares+$BLOCKSFOUND[block].estshares} - {$BLOCKSFOUND[block].estshares|number_format} + {$BLOCKSFOUND[block].estshares|number_format:$GLOBAL.config.sharediffprecision} {if $GLOBAL.config.payout_system == 'pplns'} - {$BLOCKSFOUND[block].pplns_shares|number_format} + {$BLOCKSFOUND[block].pplns_shares|number_format:$GLOBAL.config.sharediffprecision} {/if} - {$BLOCKSFOUND[block].shares|number_format} + {$BLOCKSFOUND[block].shares|number_format:$GLOBAL.config.sharediffprecision} {math assign="percentage" equation="shares / estshares * 100" shares=$BLOCKSFOUND[block].shares|default:"0" estshares=$BLOCKSFOUND[block].estshares} {$percentage|number_format:"2"} @@ -65,11 +65,11 @@ {/section} Totals - {$totalexpectedshares|number_format} + {$totalexpectedshares|number_format:$GLOBAL.config.sharediffprecision} {if $GLOBAL.config.payout_system == 'pplns'} - {$pplnsshares|number_format} + {$pplnsshares|number_format:$GLOBAL.config.sharediffprecision} {/if} - {$totalshares|number_format} + {$totalshares|number_format:$GLOBAL.config.sharediffprecision} {if $count > 0}{($totalshares / $totalexpectedshares * 100)|number_format:"2"}{else}0{/if} diff --git a/templates/bootstrap/statistics/blocks/small_table.tpl b/templates/bootstrap/statistics/blocks/small_table.tpl index 544ffd22a..f48524124 100644 --- a/templates/bootstrap/statistics/blocks/small_table.tpl +++ b/templates/bootstrap/statistics/blocks/small_table.tpl @@ -24,7 +24,7 @@ {/if} {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} {$BLOCKSFOUND[block].time|date_format:$GLOBAL.config.date} - {$BLOCKSFOUND[block].shares|number_format} + {$BLOCKSFOUND[block].shares|number_format:$GLOBAL.config.sharediffprecision} {/section} diff --git a/templates/bootstrap/statistics/pool/contributors_hashrate.tpl b/templates/bootstrap/statistics/pool/contributors_hashrate.tpl index 3b7fa0dd1..d77aeaa07 100644 --- a/templates/bootstrap/statistics/pool/contributors_hashrate.tpl +++ b/templates/bootstrap/statistics/pool/contributors_hashrate.tpl @@ -35,7 +35,7 @@ {/section} {if $listed != 1 && $GLOBAL.userdata.username|default:"" && $GLOBAL.userdata.rawhashrate|default:"0" > 0} {math assign="myestday" equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$GLOBAL.userdata.rawhashrate} - {if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|lower}{assign var=listed value=1}{else}{/if} + {if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|default:""|lower}{assign var=listed value=1}{else}{/if} n/a {if $GLOBAL.userdata.donate_percent|default:"0" >= 2}{elseif $GLOBAL.userdata.donate_percent|default:"0" < 2 AND $GLOBAL.userdata.donate_percent|default:"0" > 0}{else}{/if} {$GLOBAL.userdata.username|escape} diff --git a/templates/bootstrap/statistics/pool/contributors_shares.tpl b/templates/bootstrap/statistics/pool/contributors_shares.tpl index f0d4018ac..f9f392e49 100644 --- a/templates/bootstrap/statistics/pool/contributors_shares.tpl +++ b/templates/bootstrap/statistics/pool/contributors_shares.tpl @@ -21,15 +21,15 @@ {$rank++} {if $CONTRIBSHARES[shares].donate_percent|default:"0" >= 2}{else if $CONTRIBSHARES[shares].donate_percent|default:"0" < 2 AND $CONTRIBSHARES[shares].donate_percent|default:"0" > 0}{else}{/if} {if $CONTRIBSHARES[shares].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$CONTRIBSHARES[shares].account|escape}{/if} - {$CONTRIBSHARES[shares].shares|number_format} + {$CONTRIBSHARES[shares].shares|number_format:$GLOBAL.config.sharediffprecision} {/section} {if $listed != 1 && $GLOBAL.userdata.username|default:"" && $GLOBAL.userdata.shares.valid|default:"0" > 0} - {if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|lower}{assign var=listed value=1}{else}{/if} + {if $GLOBAL.userdata.username|default:""|lower == $CONTRIBHASHES[contrib].account|default:""|lower}{assign var=listed value=1}{else}{/if} n/a {if $GLOBAL.userdata.donate_percent|default:"0" >= 2}{elseif $GLOBAL.userdata.donate_percent|default:"0" < 2 AND $GLOBAL.userdata.donate_percent|default:"0" > 0}{else}{/if} {$GLOBAL.userdata.username|escape} - {$GLOBAL.userdata.shares.valid|number_format} + {$GLOBAL.userdata.shares.valid|number_format:$GLOBAL.config.sharediffprecision} {/if} diff --git a/templates/bootstrap/statistics/pool/general_stats.tpl b/templates/bootstrap/statistics/pool/general_stats.tpl index 9e78bcb8d..1d971be9e 100644 --- a/templates/bootstrap/statistics/pool/general_stats.tpl +++ b/templates/bootstrap/statistics/pool/general_stats.tpl @@ -44,7 +44,7 @@ Est. Shares this Round - {$ESTIMATES.shares|number_format} (done: {$ESTIMATES.percent}%) + {$ESTIMATES.shares|number_format:$GLOBAL.config.sharediffprecision} (done: {$ESTIMATES.percent}%) {if ! $GLOBAL.website.blockexplorer.disabled} diff --git a/templates/bootstrap/statistics/round/block_stats.tpl b/templates/bootstrap/statistics/round/block_stats.tpl index c09499ffd..60c58738a 100644 --- a/templates/bootstrap/statistics/round/block_stats.tpl +++ b/templates/bootstrap/statistics/round/block_stats.tpl @@ -38,7 +38,7 @@ Time {$BLOCKDETAILS.time|default:"0"} Shares - {$BLOCKDETAILS.shares|number_format:"0"|default:"0"} + {$BLOCKDETAILS.shares|number_format:$GLOBAL.config.sharediffprecision|default:"0"} Finder {$BLOCKDETAILS.finder|default:"unknown"} diff --git a/templates/bootstrap/statistics/round/pplns_block_stats.tpl b/templates/bootstrap/statistics/round/pplns_block_stats.tpl index 0874715cc..67f37fbd7 100644 --- a/templates/bootstrap/statistics/round/pplns_block_stats.tpl +++ b/templates/bootstrap/statistics/round/pplns_block_stats.tpl @@ -18,7 +18,7 @@ ID {$BLOCKDETAILS.id|number_format:"0"|default:"0"} PPLNS Shares - {$PPLNSSHARES|number_format:"0"|default:"0"} + {$PPLNSSHARES|number_format:$GLOBAL.config.sharediffprecision|default:"0"} Height @@ -28,7 +28,7 @@ {$BLOCKDETAILS.height|number_format:"0"|default:"0"} {/if} Estimated Shares - {$BLOCKDETAILS.estshares|number_format|default:"0"} + {$BLOCKDETAILS.estshares|number_format:$GLOBAL.config.sharediffprecision|default:"0"} Amount @@ -64,7 +64,7 @@ Shares - {$BLOCKDETAILS.shares|number_format:"0"|default:"0"} + {$BLOCKDETAILS.shares|number_format:$GLOBAL.config.sharediffprecision|default:"0"} Seconds This Round {$BLOCKDETAILS.round_time|number_format:"0"|default:"0"} diff --git a/templates/bootstrap/statistics/round/pplns_block_stats_small.tpl b/templates/bootstrap/statistics/round/pplns_block_stats_small.tpl index 7a0e27a5c..6f8958243 100644 --- a/templates/bootstrap/statistics/round/pplns_block_stats_small.tpl +++ b/templates/bootstrap/statistics/round/pplns_block_stats_small.tpl @@ -30,9 +30,9 @@ {$BLOCKDETAILS.height|number_format:"0"|default:"0"} {/if} PPLNS Shares - {$PPLNSSHARES|number_format:"0"|default:"0"} + {$PPLNSSHARES|number_format:$GLOBAL.config.sharediffprecision|default:"0"} Estimated Shares - {$BLOCKDETAILS.estshares|number_format|default:"0"} + {$BLOCKDETAILS.estshares|number_format:$GLOBAL.config.sharediffprecision|default:"0"} Amount @@ -61,7 +61,7 @@ Shares - {$BLOCKDETAILS.shares|number_format:"0"|default:"0"} + {$BLOCKDETAILS.shares|number_format:$GLOBAL.config.sharediffprecision|default:"0"} Finder {$BLOCKDETAILS.finder|default:"unknown"} Seconds This Round diff --git a/templates/bootstrap/statistics/round/pplns_round_shares.tpl b/templates/bootstrap/statistics/round/pplns_round_shares.tpl index a0645240c..0159c5b38 100644 --- a/templates/bootstrap/statistics/round/pplns_round_shares.tpl +++ b/templates/bootstrap/statistics/round/pplns_round_shares.tpl @@ -21,8 +21,8 @@ {$rank++} {if $PPLNSROUNDSHARES[contrib].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$PPLNSROUNDSHARES[contrib].username|default:"unknown"|escape}{/if} - {$PPLNSROUNDSHARES[contrib].pplns_valid|number_format} - {$PPLNSROUNDSHARES[contrib].pplns_invalid|number_format} + {$PPLNSROUNDSHARES[contrib].pplns_valid|number_format:$GLOBAL.config.sharediffprecision|default:0} + {$PPLNSROUNDSHARES[contrib].pplns_invalid|number_format:$GLOBAL.config.sharediffprecision|default:0} {if $PPLNSROUNDSHARES[contrib].pplns_invalid > 0 && $PPLNSROUNDSHARES[contrib].pplns_valid > 0}{($PPLNSROUNDSHARES[contrib].pplns_invalid / $PPLNSROUNDSHARES[contrib].pplns_valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if} {/section} diff --git a/templates/bootstrap/statistics/round/pplns_transactions.tpl b/templates/bootstrap/statistics/round/pplns_transactions.tpl index 7ab591325..7798ae40a 100644 --- a/templates/bootstrap/statistics/round/pplns_transactions.tpl +++ b/templates/bootstrap/statistics/round/pplns_transactions.tpl @@ -23,9 +23,9 @@ {section txs $ROUNDTRANSACTIONS} {if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if} - {$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|default:"0"} + {$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|default:0} {if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|default:"0" > 0 }{(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|number_format:"2"}{else}0.00{/if} - {$PPLNSROUNDSHARES[txs].pplns_valid|number_format:$GLOBAL.config.sharediffprecision|default:"0"} + {$PPLNSROUNDSHARES[txs].pplns_valid|number_format:$GLOBAL.config.sharediffprecision|default:0} {if $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" > 0 }{(( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)|number_format:"2"|default:"0"}{else}0{/if} {if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|default:"0" > 0 && $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" > 0}{math assign="percentage1" equation=(100 / ((( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid) / (( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)))}{else if $PPLNSROUNDSHARES[txs].pplns_valid|default:"0" == 0}{assign var=percentage1 value=0}{else}{assign var=percentage1 value=100}{/if} {$percentage1|number_format:"2"} diff --git a/templates/bootstrap/statistics/round/pplns_transactions_small.tpl b/templates/bootstrap/statistics/round/pplns_transactions_small.tpl index 7217c522b..b95845fae 100644 --- a/templates/bootstrap/statistics/round/pplns_transactions_small.tpl +++ b/templates/bootstrap/statistics/round/pplns_transactions_small.tpl @@ -26,12 +26,12 @@ {section txs $ROUNDTRANSACTIONS} {if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if} - {$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid|number_format} - {$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid|number_format} + {$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid|number_format:$GLOBAL.config.sharediffprecision} + {$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid|number_format:$GLOBAL.config.sharediffprecision} {if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid > 0 }{($SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid / $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if} {if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid > 0 }{(( 100 / $BLOCKDETAILS.shares) * $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid)|number_format:"2"}{else}0.00{/if} - {$PPLNSROUNDSHARES[txs].pplns_valid|number_format} - {$PPLNSROUNDSHARES[txs].pplns_invalid|number_format} + {$PPLNSROUNDSHARES[txs].pplns_valid|number_format:$GLOBAL.config.sharediffprecision} + {$PPLNSROUNDSHARES[txs].pplns_invalid|number_format:$GLOBAL.config.sharediffprecision} {if $PPLNSROUNDSHARES[txs].pplns_invalid > 0 }{($PPLNSROUNDSHARES[txs].pplns_invalid / $PPLNSROUNDSHARES[txs].pplns_valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if} {(( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)|number_format:"2"} {if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid > 0 }{math assign="percentage1" equation=(100 / ((( 100 / $BLOCKDETAILS.shares) * $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid) / (( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)))}{else if $PPLNSROUNDSHARES[txs].pplns_valid == 0}{assign var=percentage1 value=0}{else}{assign var=percentage1 value=100}{/if} diff --git a/templates/bootstrap/statistics/round/round_shares.tpl b/templates/bootstrap/statistics/round/round_shares.tpl index 7cc8bb97f..96c23383d 100644 --- a/templates/bootstrap/statistics/round/round_shares.tpl +++ b/templates/bootstrap/statistics/round/round_shares.tpl @@ -22,8 +22,8 @@ {$rank++} {if $data.is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$data.username|default:"unknown"|escape}{/if} - {$data.valid|number_format} - {$data.invalid|number_format} + {$data.valid|number_format:$GLOBAL.config.sharediffprecision|default:0} + {$data.invalid|number_format:$GLOBAL.config.sharediffprecision|default:0} {if $data.invalid > 0 }{($data.invalid / $data.valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if} {/foreach} diff --git a/templates/bootstrap/statistics/round/round_transactions.tpl b/templates/bootstrap/statistics/round/round_transactions.tpl index 2d0b24a23..c102c9ccf 100644 --- a/templates/bootstrap/statistics/round/round_transactions.tpl +++ b/templates/bootstrap/statistics/round/round_transactions.tpl @@ -20,7 +20,7 @@ {if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|default:"unknown"|escape}{/if} {$ROUNDTRANSACTIONS[txs].type|default:""} - {$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|default:"0"} + {$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format:$GLOBAL.config.sharediffprecision|default:0} {(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|default:"0"|number_format:"2"} {$ROUNDTRANSACTIONS[txs].amount|default:"0"|number_format:"8"} diff --git a/upgrade/definitions/1.0.2_to_1.0.3.inc.php b/upgrade/definitions/1.0.2_to_1.0.3.inc.php index 3a90b33f2..28f2578dd 100644 --- a/upgrade/definitions/1.0.2_to_1.0.3.inc.php +++ b/upgrade/definitions/1.0.2_to_1.0.3.inc.php @@ -9,9 +9,10 @@ function run_103() { $db_version_now = $setting->getValue('DB_VERSION'); // Our actual version installed // Upgrade specific variables + $aSql[] = "ALTER TABLE `blocks` CHANGE `shares` `shares` DOUBLE UNSIGNED DEFAULT NULL;"; $aSql[] = "UPDATE `statistics_shares` SET `valid` = '0' WHERE `valid` IS NULL;"; $aSql[] = "UPDATE `statistics_shares` SET `pplns_valid` = '0' WHERE `pplns_valid` IS NULL;"; - $aSql[] = "ALTER TABLE `statistics_shares` CHANGE `valid` `valid` FLOAT NOT NULL DEFAULT '0', CHANGE `invalid` `invalid` FLOAT NOT NULL DEFAULT '0', CHANGE `pplns_valid` `pplns_valid` FLOAT NOT NULL DEFAULT '0', CHANGE `pplns_invalid` `pplns_invalid` FLOAT NOT NULL DEFAULT '0';"; + $aSql[] = "ALTER TABLE `statistics_shares` CHANGE `valid` `valid` FLOAT UNSIGNED NOT NULL DEFAULT '0', CHANGE `invalid` `invalid` FLOAT UNSIGNED NOT NULL DEFAULT '0', CHANGE `pplns_valid` `pplns_valid` FLOAT UNSIGNED NOT NULL DEFAULT '0', CHANGE `pplns_invalid` `pplns_invalid` FLOAT UNSIGNED NOT NULL DEFAULT '0';"; $aSql[] = "UPDATE " . $setting->getTableName() . " SET value = '" . $db_version_new . "' WHERE name = 'DB_VERSION';"; if ($db_version_now == $db_version_old && version_compare($db_version_now, DB_VERSION, '<')) {