mirror of
https://github.com/jwinterm/nodejs-pool.git
synced 2026-10-17 05:21:27 +02:00
If share.shares is not a number, don't try to add it to the processing list.
This commit is contained in:
+67
-65
@@ -192,74 +192,76 @@ function Database(){
|
|||||||
shareObject.forEach(function(share){
|
shareObject.forEach(function(share){
|
||||||
//Data is the share object at this point.
|
//Data is the share object at this point.
|
||||||
shareCount += 1;
|
shareCount += 1;
|
||||||
if (!shares.hasOwnProperty(share.blockHeight)){
|
if (typeof(share.shares) === "number") {
|
||||||
shares[share.blockHeight] = [];
|
if (!shares.hasOwnProperty(share.blockHeight)) {
|
||||||
}
|
shares[share.blockHeight] = [];
|
||||||
shares[share.blockHeight].push(share);
|
|
||||||
let minerID = share.paymentAddress;
|
|
||||||
if (typeof(share.paymentID) !== 'undefined' && share.paymentID.length > 10) {
|
|
||||||
minerID = minerID + '.' + share.paymentID;
|
|
||||||
}
|
|
||||||
let minerIDWithIdentifier = minerID + "_" + share.identifier;
|
|
||||||
// this.incrementCacheData('global_stats', [{location: 'totalHashes', value: share.shares}, {location: 'roundHashes', value: share.shares}]);
|
|
||||||
if (!cachedData.global_stats.hasOwnProperty('totalHashes') || cachedData.global_stats.totalHashes === null){
|
|
||||||
cachedData.global_stats.totalHashes = 0;
|
|
||||||
}
|
|
||||||
if (!cachedData.global_stats.hasOwnProperty('roundHashes') || cachedData.global_stats.roundHashes === null){
|
|
||||||
cachedData.global_stats.roundHashes = 0;
|
|
||||||
}
|
|
||||||
cachedData.global_stats.totalHashes += share.shares;
|
|
||||||
cachedData.global_stats.roundHashes += share.shares;
|
|
||||||
let stats_type = 'pplns_stats';
|
|
||||||
switch (share.poolType) {
|
|
||||||
case global.protos.POOLTYPE.PPLNS:
|
|
||||||
stats_type = 'pplns_stats';
|
|
||||||
break;
|
|
||||||
case global.protos.POOLTYPE.PPS:
|
|
||||||
stats_type = 'pps_stats';
|
|
||||||
break;
|
|
||||||
case global.protos.POOLTYPE.SOLO:
|
|
||||||
stats_type = 'solo_stats';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!cachedData[stats_type].hasOwnProperty('totalHashes') || cachedData[stats_type].totalHashes === null){
|
|
||||||
cachedData[stats_type].totalHashes = 0;
|
|
||||||
}
|
|
||||||
if (!cachedData[stats_type].hasOwnProperty('roundHashes') || cachedData[stats_type].roundHashes === null){
|
|
||||||
cachedData[stats_type].roundHashes = 0;
|
|
||||||
}
|
|
||||||
cachedData[stats_type].totalHashes += share.shares;
|
|
||||||
cachedData[stats_type].roundHashes += share.shares;
|
|
||||||
if (!cachedData.hasOwnProperty(minerID)){
|
|
||||||
let minerCache = global.database.getCache(minerID);
|
|
||||||
if (minerCache === false){
|
|
||||||
minerCache = {totalHashes: 0, goodShares: 0};
|
|
||||||
}
|
}
|
||||||
cachedData[minerID] = minerCache;
|
shares[share.blockHeight].push(share);
|
||||||
}
|
let minerID = share.paymentAddress;
|
||||||
if (!cachedData.hasOwnProperty(minerIDWithIdentifier)){
|
if (typeof(share.paymentID) !== 'undefined' && share.paymentID.length > 10) {
|
||||||
let minerCache = global.database.getCache(minerIDWithIdentifier);
|
minerID = minerID + '.' + share.paymentID;
|
||||||
if (minerCache === false){
|
|
||||||
minerCache = {totalHashes: 0, goodShares: 0};
|
|
||||||
}
|
}
|
||||||
cachedData[minerIDWithIdentifier] = minerCache;
|
let minerIDWithIdentifier = minerID + "_" + share.identifier;
|
||||||
|
// this.incrementCacheData('global_stats', [{location: 'totalHashes', value: share.shares}, {location: 'roundHashes', value: share.shares}]);
|
||||||
|
if (!cachedData.global_stats.hasOwnProperty('totalHashes') || cachedData.global_stats.totalHashes === null) {
|
||||||
|
cachedData.global_stats.totalHashes = 0;
|
||||||
|
}
|
||||||
|
if (!cachedData.global_stats.hasOwnProperty('roundHashes') || cachedData.global_stats.roundHashes === null) {
|
||||||
|
cachedData.global_stats.roundHashes = 0;
|
||||||
|
}
|
||||||
|
cachedData.global_stats.totalHashes += share.shares;
|
||||||
|
cachedData.global_stats.roundHashes += share.shares;
|
||||||
|
let stats_type = 'pplns_stats';
|
||||||
|
switch (share.poolType) {
|
||||||
|
case global.protos.POOLTYPE.PPLNS:
|
||||||
|
stats_type = 'pplns_stats';
|
||||||
|
break;
|
||||||
|
case global.protos.POOLTYPE.PPS:
|
||||||
|
stats_type = 'pps_stats';
|
||||||
|
break;
|
||||||
|
case global.protos.POOLTYPE.SOLO:
|
||||||
|
stats_type = 'solo_stats';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!cachedData[stats_type].hasOwnProperty('totalHashes') || cachedData[stats_type].totalHashes === null) {
|
||||||
|
cachedData[stats_type].totalHashes = 0;
|
||||||
|
}
|
||||||
|
if (!cachedData[stats_type].hasOwnProperty('roundHashes') || cachedData[stats_type].roundHashes === null) {
|
||||||
|
cachedData[stats_type].roundHashes = 0;
|
||||||
|
}
|
||||||
|
cachedData[stats_type].totalHashes += share.shares;
|
||||||
|
cachedData[stats_type].roundHashes += share.shares;
|
||||||
|
if (!cachedData.hasOwnProperty(minerID)) {
|
||||||
|
let minerCache = global.database.getCache(minerID);
|
||||||
|
if (minerCache === false) {
|
||||||
|
minerCache = {totalHashes: 0, goodShares: 0};
|
||||||
|
}
|
||||||
|
cachedData[minerID] = minerCache;
|
||||||
|
}
|
||||||
|
if (!cachedData.hasOwnProperty(minerIDWithIdentifier)) {
|
||||||
|
let minerCache = global.database.getCache(minerIDWithIdentifier);
|
||||||
|
if (minerCache === false) {
|
||||||
|
minerCache = {totalHashes: 0, goodShares: 0};
|
||||||
|
}
|
||||||
|
cachedData[minerIDWithIdentifier] = minerCache;
|
||||||
|
}
|
||||||
|
if (!cachedData[minerIDWithIdentifier].hasOwnProperty('totalHashes') || cachedData[minerIDWithIdentifier].totalHashes === null) {
|
||||||
|
cachedData[minerIDWithIdentifier].totalHashes = 0;
|
||||||
|
}
|
||||||
|
if (!cachedData[minerIDWithIdentifier].hasOwnProperty('goodShares') || cachedData[minerIDWithIdentifier].goodShares === null) {
|
||||||
|
cachedData[minerIDWithIdentifier].goodShares = 0;
|
||||||
|
}
|
||||||
|
if (!cachedData[minerID].hasOwnProperty('totalHashes') || cachedData[minerID].totalHashes === null) {
|
||||||
|
cachedData[minerID].totalHashes = 0;
|
||||||
|
}
|
||||||
|
if (!cachedData[minerID].hasOwnProperty('goodShares') || cachedData[minerID].goodShares === null) {
|
||||||
|
cachedData[minerID].goodShares = 0;
|
||||||
|
}
|
||||||
|
cachedData[minerIDWithIdentifier].totalHashes += share.shares;
|
||||||
|
cachedData[minerID].totalHashes += share.shares;
|
||||||
|
cachedData[minerIDWithIdentifier].goodShares += 1;
|
||||||
|
cachedData[minerID].goodShares += 1;
|
||||||
}
|
}
|
||||||
if (!cachedData[minerIDWithIdentifier].hasOwnProperty('totalHashes') || cachedData[minerIDWithIdentifier].totalHashes === null){
|
|
||||||
cachedData[minerIDWithIdentifier].totalHashes = 0;
|
|
||||||
}
|
|
||||||
if (!cachedData[minerIDWithIdentifier].hasOwnProperty('goodShares') || cachedData[minerIDWithIdentifier].goodShares === null){
|
|
||||||
cachedData[minerIDWithIdentifier].goodShares = 0;
|
|
||||||
}
|
|
||||||
if (!cachedData[minerID].hasOwnProperty('totalHashes') || cachedData[minerID].totalHashes === null){
|
|
||||||
cachedData[minerID].totalHashes = 0;
|
|
||||||
}
|
|
||||||
if (!cachedData[minerID].hasOwnProperty('goodShares') || cachedData[minerID].goodShares === null){
|
|
||||||
cachedData[minerID].goodShares = 0;
|
|
||||||
}
|
|
||||||
cachedData[minerIDWithIdentifier].totalHashes += share.shares;
|
|
||||||
cachedData[minerID].totalHashes += share.shares;
|
|
||||||
cachedData[minerIDWithIdentifier].goodShares += 1;
|
|
||||||
cachedData[minerID].goodShares += 1;
|
|
||||||
if(shareObject.length === shareCount){
|
if(shareObject.length === shareCount){
|
||||||
// Perform insert and return
|
// Perform insert and return
|
||||||
let txn = global.database.env.beginTxn();
|
let txn = global.database.env.beginTxn();
|
||||||
|
|||||||
Reference in New Issue
Block a user