From 30df2607385e47893505abf323066fab2645c7ec Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 22 May 2013 15:44:49 +0300 Subject: [PATCH 1/6] Update README.md Added donation hint :) --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 6d3dd879..69a0e8ec 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,13 @@ future. I do not recommend using this for a live setup as of yet. Wait for the later Release Candidate if you wish to run your pool with it. Testing pools are much appreciated though! +Donations +========= + +I was hoping to keep this out of the README but apparently people remove or change the LTC address +at the bottom of the page. For those of you finding my project and are willing to appreciate the work +with some hard earned LTC feel free to donate to my LTC address: `Lge95QR2frp9y1wJufjUPCycVsg5gLJPW8` + Requirements ============ From f42b4d81caac06768b1f673a689e02b2ccbd3bad Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 22 May 2013 15:45:32 +0200 Subject: [PATCH 2/6] adding user to top stats to always display even if not part of results --- .../mmcFE/statistics/pool/contributors_hashrate.tpl | 13 +++++++++++-- .../mmcFE/statistics/pool/contributors_shares.tpl | 10 +++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl b/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl index f9f9c27f..92f92a05 100644 --- a/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl +++ b/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl @@ -11,14 +11,23 @@ {assign var=rank value=1} +{assign var=listed value=0} {section contrib $CONTRIBHASHES} - + {$rank++} {$CONTRIBHASHES[contrib].account} {$CONTRIBHASHES[contrib].hashrate|number_format} - {math equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24),3)" diff=$DIFFICULTY reward=$REWARD hashrate=$CONTRIBHASHES[contrib].hashrate} + {math equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24) * (0.2 / 100) ,3)" diff=$DIFFICULTY reward=$REWARD hashrate=$CONTRIBHASHES[contrib].hashrate} {/section} +{if $listed != 1} + + n/a + {$GLOBAL.userdata.username} + {$GLOBAL.userdata.hashrate} + {math equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24) * (0.2 / 100) ,3)" diff=$DIFFICULTY reward=$REWARD hashrate=$GLOBAL.userdata.hashrate} + +{/if} diff --git a/public/templates/mmcFE/statistics/pool/contributors_shares.tpl b/public/templates/mmcFE/statistics/pool/contributors_shares.tpl index 1214ef44..8fbd590a 100644 --- a/public/templates/mmcFE/statistics/pool/contributors_shares.tpl +++ b/public/templates/mmcFE/statistics/pool/contributors_shares.tpl @@ -10,13 +10,21 @@ {assign var=rank value=1} +{assign var=listed value=0} {section hashrate $CONTRIBSHARES} - + {$rank++} {$CONTRIBSHARES[hashrate].account} {$CONTRIBSHARES[hashrate].shares|number_format} {/section} +{if $listed != 1} + + n/a + {$GLOBAL.userdata.username} + {$GLOBAL.userdata.shares.valid} + +{/if} From eae1f564dd53b8f3f81a7c03dbedbed3bb0153d8 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 22 May 2013 16:00:27 +0200 Subject: [PATCH 3/6] adding proper difficulty when not authenticated --- public/templates/mmcFE/statistics/default.tpl | 2 +- public/templates/mmcFE/statistics/pool/default.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/templates/mmcFE/statistics/default.tpl b/public/templates/mmcFE/statistics/default.tpl index 7c274cea..d1dfd202 100644 --- a/public/templates/mmcFE/statistics/default.tpl +++ b/public/templates/mmcFE/statistics/default.tpl @@ -15,7 +15,7 @@ Current Difficulty - {$CURRENTDIFFICULTY} + {$DIFFICULTY} diff --git a/public/templates/mmcFE/statistics/pool/default.tpl b/public/templates/mmcFE/statistics/pool/default.tpl index 7c274cea..d1dfd202 100644 --- a/public/templates/mmcFE/statistics/pool/default.tpl +++ b/public/templates/mmcFE/statistics/pool/default.tpl @@ -15,7 +15,7 @@ Current Difficulty - {$CURRENTDIFFICULTY} + {$DIFFICULTY} From c30bd0ee6076171c56c88f0cb80ea807396e4ecf Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 22 May 2013 16:03:16 +0200 Subject: [PATCH 4/6] fixing LTC/day display from earlier commit --- .../templates/mmcFE/statistics/pool/contributors_hashrate.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl b/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl index 92f92a05..7b52cc0b 100644 --- a/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl +++ b/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl @@ -17,7 +17,7 @@ {$rank++} {$CONTRIBHASHES[contrib].account} {$CONTRIBHASHES[contrib].hashrate|number_format} - {math equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24) * (0.2 / 100) ,3)" diff=$DIFFICULTY reward=$REWARD hashrate=$CONTRIBHASHES[contrib].hashrate} + {math equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$CONTRIBHASHES[contrib].hashrate} {/section} {if $listed != 1} @@ -25,7 +25,7 @@ n/a {$GLOBAL.userdata.username} {$GLOBAL.userdata.hashrate} - {math equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24) * (0.2 / 100) ,3)" diff=$DIFFICULTY reward=$REWARD hashrate=$GLOBAL.userdata.hashrate} + {math equation="round(reward / ( diff * pow(2,32) / ( hashrate * 1000 ) / 3600 / 24), 3)" diff=$DIFFICULTY reward=$REWARD hashrate=$GLOBAL.userdata.hashrate} {/if} From e078c5447a9dbbffb4ee8338ca84109ad069878f Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 22 May 2013 17:09:49 +0200 Subject: [PATCH 5/6] properly highlight user in top tables even if row is of class even --- .../mmcFE/statistics/pool/contributors_hashrate.tpl | 5 ++--- .../templates/mmcFE/statistics/pool/contributors_shares.tpl | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl b/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl index 7b52cc0b..30dbf416 100644 --- a/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl +++ b/public/templates/mmcFE/statistics/pool/contributors_hashrate.tpl @@ -1,6 +1,6 @@ {include file="global/block_header.tpl" ALIGN="left" BLOCK_HEADER="Top Hashrate Contributers"}
- +
@@ -13,7 +13,7 @@ {assign var=rank value=1} {assign var=listed value=0} {section contrib $CONTRIBHASHES} - + @@ -30,6 +30,5 @@ {/if}
Rank
{$rank++} {$CONTRIBHASHES[contrib].account} {$CONTRIBHASHES[contrib].hashrate|number_format}
-
{include file="global/block_footer.tpl"} diff --git a/public/templates/mmcFE/statistics/pool/contributors_shares.tpl b/public/templates/mmcFE/statistics/pool/contributors_shares.tpl index 8fbd590a..02f33283 100644 --- a/public/templates/mmcFE/statistics/pool/contributors_shares.tpl +++ b/public/templates/mmcFE/statistics/pool/contributors_shares.tpl @@ -1,6 +1,6 @@ {include file="global/block_header.tpl" ALIGN="right" BLOCK_HEADER="Top Share Contributers"}
- +
@@ -12,7 +12,7 @@ {assign var=rank value=1} {assign var=listed value=0} {section hashrate $CONTRIBSHARES} - + @@ -27,6 +27,5 @@ {/if}
Rank
{$rank++} {$CONTRIBSHARES[hashrate].account} {$CONTRIBSHARES[hashrate].shares|number_format}
-
{include file="global/block_footer.tpl"} From dfc3dc43e5394aaea371d9c996a935de453866d0 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Wed, 22 May 2013 20:07:28 +0200 Subject: [PATCH 6/6] use difficulty set in config, not hard coded, for worker hashrates --- public/include/classes/worker.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/include/classes/worker.class.php b/public/include/classes/worker.class.php index b2039dd4..85254900 100644 --- a/public/include/classes/worker.class.php +++ b/public/include/classes/worker.class.php @@ -8,11 +8,12 @@ class Worker { private $sError = ''; private $table = 'workers'; - public function __construct($debug, $mysqli, $user, $share) { + public function __construct($debug, $mysqli, $user, $share, $config) { $this->debug = $debug; $this->mysqli = $mysqli; $this->user = $user; $this->share = $share; + $this->config = $config; $this->debug->append("Instantiated Worker class", 2); } @@ -63,7 +64,7 @@ class Worker { $stmt = $this->mysqli->prepare(" SELECT id, username, password, ( SELECT SIGN(COUNT(id)) FROM " . $this->share->getTableName() . " WHERE username = $this->table.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)) AS active, - ( SELECT ROUND(COUNT(id) * POW(2,21)/600/1000) FROM " . $this->share->getTableName() . " WHERE username = $this->table.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)) AS hashrate + ( SELECT ROUND(COUNT(id) * POW(2, " . $this->config['difficulty'] . ")/600/1000) FROM " . $this->share->getTableName() . " WHERE username = $this->table.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)) AS hashrate FROM $this->table WHERE account_id = ?"); if ($this->checkStmt($stmt) && $stmt->bind_param('i', $account_id) && $stmt->execute() && $result = $stmt->get_result()) @@ -138,4 +139,4 @@ class Worker { } } -$worker = new Worker($debug, $mysqli, $user, $share); +$worker = new Worker($debug, $mysqli, $user, $share, $config);