mirror of
https://github.com/jwinterm/nodejs-pool.git
synced 2026-10-17 05:21:27 +02:00
+6
-12
@@ -343,7 +343,9 @@ app.get('/miner/:address/stats/:identifier', function (req, res) {
|
||||
lts: Math.floor(cachedData.lastHash / 1000),
|
||||
identifer: identifier,
|
||||
hash: cachedData.hash,
|
||||
totalHash: cachedData.totalHashes
|
||||
totalHash: cachedData.totalHashes,
|
||||
validShares: Number(cachedData.goodShares),
|
||||
invalidShares: Number(cachedData.badShares)
|
||||
});
|
||||
});
|
||||
|
||||
@@ -374,6 +376,7 @@ app.get('/miner/:address/stats', function (req, res) {
|
||||
let address_parts = req.params.address.split('.');
|
||||
let address_pt = address_parts[0];
|
||||
let payment_id = address_parts[1];
|
||||
let cachedData = global.database.getCache(address);
|
||||
let paidQuery = "SELECT SUM(amount) as amt FROM payments WHERE payment_address = ? AND payment_id = ?";
|
||||
let txnCount = "SELECT count(id) as amt FROM payments WHERE payment_address = ? AND payment_id = ?";
|
||||
let unpaidQuery = "SELECT SUM(amount) as amt FROM balance WHERE payment_address = ? AND payment_id = ?";
|
||||
@@ -385,17 +388,8 @@ app.get('/miner/:address/stats', function (req, res) {
|
||||
async.waterfall([
|
||||
function (callback) {
|
||||
debug(threadName + "Checking Influx for last 10min avg for /miner/address/stats");
|
||||
return callback(null, {hash: global.database.getCache(address).hash, identifier: 'global'});
|
||||
},
|
||||
function (returnData, callback) {
|
||||
// TODO: Fixme once we have total hash counts...
|
||||
returnData.totalHashes = global.database.getCache(address).totalHashes;
|
||||
return callback(null, returnData);
|
||||
},
|
||||
function (returnData, callback) {
|
||||
debug(threadName + "Checking Influx for last share for /miner/address/stats");
|
||||
returnData.lastHash = Math.floor(global.database.getCache(address).lastHash / 1000);
|
||||
return callback(null, returnData);
|
||||
return callback(null, {hash: cachedData.hash, identifier: 'global', lastHash: Math.floor(cachedData.lastHash / 1000),
|
||||
totalHashes: cachedData.totalHashes, validShares: Number(cachedData.goodShares), invalidShares: Number(cachedData.badShares)});
|
||||
},
|
||||
function (returnData, callback) {
|
||||
debug(threadName + "Checking MySQL total amount paid for /miner/address/stats");
|
||||
|
||||
Reference in New Issue
Block a user