|
|
|
@ -61,7 +61,11 @@ function Database(){
|
|
|
|
|
if (!cached.hasOwnProperty(intDict.location)){
|
|
|
|
|
cached[intDict.location] = 0;
|
|
|
|
|
}
|
|
|
|
|
cached[intDict.location] += intDict.value;
|
|
|
|
|
if (intDict.value === false){
|
|
|
|
|
cached[intDict.location] = 0;
|
|
|
|
|
} else {
|
|
|
|
|
cached[intDict.location] += intDict.value;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
txn.putString(this.cacheDB, key, JSON.stringify(cached));
|
|
|
|
|
txn.commit();
|
|
|
|
@ -150,16 +154,16 @@ function Database(){
|
|
|
|
|
minerID = minerID + '.' + share.paymentID;
|
|
|
|
|
}
|
|
|
|
|
let minerIDWithIdentifier = minerID + "_" + share.identifier;
|
|
|
|
|
this.incrementCacheData('global_stats', [{location: 'totalHashes', value: share.shares}]);
|
|
|
|
|
this.incrementCacheData('global_stats', [{location: 'totalHashes', value: share.shares}, {location: 'roundHashes', value: share.shares}]);
|
|
|
|
|
switch (share.poolType) {
|
|
|
|
|
case global.protos.POOLTYPE.PPLNS:
|
|
|
|
|
this.incrementCacheData('pplns_stats', [{location: 'totalHashes', value: share.shares}]);
|
|
|
|
|
this.incrementCacheData('pplns_stats', [{location: 'totalHashes', value: share.shares}, {location: 'roundHashes', value: share.shares}]);
|
|
|
|
|
break;
|
|
|
|
|
case global.protos.POOLTYPE.PPS:
|
|
|
|
|
this.incrementCacheData('pps_stats', [{location: 'totalHashes', value: share.shares}]);
|
|
|
|
|
this.incrementCacheData('pps_stats', [{location: 'totalHashes', value: share.shares}, {location: 'roundHashes', value: share.shares}]);
|
|
|
|
|
break;
|
|
|
|
|
case global.protos.POOLTYPE.SOLO:
|
|
|
|
|
this.incrementCacheData('solo_stats', [{location: 'totalHashes', value: share.shares}]);
|
|
|
|
|
this.incrementCacheData('solo_stats', [{location: 'totalHashes', value: share.shares}, {location: 'roundHashes', value: share.shares}]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
this.incrementCacheData(minerIDWithIdentifier, [{location: 'totalHashes', value: share.shares},{location: 'goodShares', value: 1}]);
|
|
|
|
@ -255,6 +259,18 @@ function Database(){
|
|
|
|
|
let txn = global.database.env.beginTxn();
|
|
|
|
|
txn.putBinary(global.database.blockDB, blockId, blockData);
|
|
|
|
|
txn.commit();
|
|
|
|
|
global.database.incrementCacheData('global_stats', [{location: 'roundHashes', value: false}]);
|
|
|
|
|
switch (blockDataDecoded.poolType) {
|
|
|
|
|
case global.protos.POOLTYPE.PPLNS:
|
|
|
|
|
global.database.incrementCacheData('pplns_stats', [{location: 'roundHashes', value: false}]);
|
|
|
|
|
break;
|
|
|
|
|
case global.protos.POOLTYPE.PPS:
|
|
|
|
|
global.database.incrementCacheData('pps_stats', [{location: 'roundHashes', value: false}]);
|
|
|
|
|
break;
|
|
|
|
|
case global.protos.POOLTYPE.SOLO:
|
|
|
|
|
global.database.incrementCacheData('solo_stats', [{location: 'roundHashes', value: false}]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return callback(true);
|
|
|
|
|
});
|
|
|
|
|
} catch (e) {
|
|
|
|
|