Update to include roundHashes

Update to fix an API bug with identifiers
Moving payments that fail due to $$ to retry in 30 minutes - Need to block if it's payment ID based.
This commit is contained in:
Alexander Blair
2017-02-15 18:49:12 -08:00
parent aa0353868c
commit bf730fddbe
4 changed files with 38 additions and 8 deletions
+21 -5
View File
@@ -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) {