Stats now use algo data from stratum-pool module
This commit is contained in:
parent
da0bbd0b44
commit
9b3d5766df
@ -21,7 +21,7 @@
|
|||||||
"siteTitle": "Cryppit",
|
"siteTitle": "Cryppit",
|
||||||
"port": 80,
|
"port": 80,
|
||||||
"statUpdateInterval": 1.5,
|
"statUpdateInterval": 1.5,
|
||||||
"hashrateWindow": 600
|
"hashrateWindow": 300
|
||||||
},
|
},
|
||||||
"proxy": {
|
"proxy": {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
|
|||||||
@ -3,6 +3,8 @@ var async = require('async');
|
|||||||
|
|
||||||
var os = require('os');
|
var os = require('os');
|
||||||
|
|
||||||
|
var algos = require('stratum-pool/lib/algoProperties.js');
|
||||||
|
|
||||||
|
|
||||||
module.exports = function(logger, portalConfig, poolConfigs){
|
module.exports = function(logger, portalConfig, poolConfigs){
|
||||||
|
|
||||||
@ -12,12 +14,12 @@ module.exports = function(logger, portalConfig, poolConfigs){
|
|||||||
|
|
||||||
var redisClients = [];
|
var redisClients = [];
|
||||||
|
|
||||||
var algoMultipliers = {
|
/*var algoMultipliers = {
|
||||||
'x11': Math.pow(2, 16),
|
'x11': Math.pow(2, 16),
|
||||||
'scrypt': Math.pow(2, 16),
|
'scrypt': Math.pow(2, 16),
|
||||||
'scrypt-jane': Math.pow(2,16),
|
'scrypt-jane': Math.pow(2,16),
|
||||||
'sha256': Math.pow(2, 32)
|
'sha256': Math.pow(2, 32)
|
||||||
};
|
};*/
|
||||||
|
|
||||||
var canDoStats = true;
|
var canDoStats = true;
|
||||||
|
|
||||||
@ -128,7 +130,7 @@ module.exports = function(logger, portalConfig, poolConfigs){
|
|||||||
coinStats.shares = 0;
|
coinStats.shares = 0;
|
||||||
coinStats.hashrates.forEach(function(ins){
|
coinStats.hashrates.forEach(function(ins){
|
||||||
var parts = ins.split(':');
|
var parts = ins.split(':');
|
||||||
var workerShares = parseInt(parts[0]);
|
var workerShares = parseFloat(parts[0]);
|
||||||
coinStats.shares += workerShares;
|
coinStats.shares += workerShares;
|
||||||
var worker = parts[1];
|
var worker = parts[1];
|
||||||
if (worker in coinStats.workers)
|
if (worker in coinStats.workers)
|
||||||
@ -136,13 +138,14 @@ module.exports = function(logger, portalConfig, poolConfigs){
|
|||||||
else
|
else
|
||||||
coinStats.workers[worker] = workerShares
|
coinStats.workers[worker] = workerShares
|
||||||
});
|
});
|
||||||
var shareMultiplier = algoMultipliers[coinStats.algorithm];
|
var shareMultiplier = algos[coinStats.algorithm].multiplier || 0;
|
||||||
var hashratePre = shareMultiplier * coinStats.shares / portalConfig.website.hashrateWindow;
|
var hashratePre = shareMultiplier * coinStats.shares / portalConfig.website.hashrateWindow;
|
||||||
|
console.log([hashratePre, shareMultiplier, coinStats.shares, portalConfig.website.hashrateWindow]);
|
||||||
coinStats.hashrate = hashratePre / 1e3 | 0;
|
coinStats.hashrate = hashratePre / 1e3 | 0;
|
||||||
portalStats.global.hashrate += coinStats.hashrate;
|
portalStats.global.hashrate += coinStats.hashrate;
|
||||||
portalStats.global.workers += Object.keys(coinStats.workers).length;
|
portalStats.global.workers += Object.keys(coinStats.workers).length;
|
||||||
delete coinStats.hashrates;
|
coinStats.hashrates;
|
||||||
delete coinStats.shares;
|
coinStats.shares;
|
||||||
});
|
});
|
||||||
|
|
||||||
_this.stats = portalStats;
|
_this.stats = portalStats;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user