mirror of https://github.com/BTCPrivate/z-nomp.git
Update shareProcessor.js
Track miner times by address not worker name
This commit is contained in:
parent
4e23d7cace
commit
0f6192e3aa
|
@ -93,17 +93,18 @@ module.exports = function(logger, poolConfig){
|
|||
if (isValidShare || isValidBlock) {
|
||||
var now = Date.now();
|
||||
var lastShareTime = now;
|
||||
if (_lastShareTimes[shareData.worker] != null && _lastShareTimes[shareData.worker] > 0)
|
||||
lastShareTime = _lastShareTimes[shareData.worker];
|
||||
var workerAddress = shareData.worker.split('.')[0];
|
||||
if (_lastShareTimes[workerAddress] != null && _lastShareTimes[workerAddress] > 0)
|
||||
lastShareTime = _lastShareTimes[workerAddress];
|
||||
|
||||
// if its been less than 10 minutes since last share was submitted
|
||||
var timeChangeSec = roundTo(Math.max(now - lastShareTime, 0) / 1000, 3);
|
||||
if (timeChangeSec < 600) {
|
||||
redisCommands.push(['hincrbyfloat', coin + ':shares:timesCurrent', shareData.worker, timeChangeSec]);
|
||||
redisCommands.push(['hincrbyfloat', coin + ':shares:timesCurrent', workerAddress, timeChangeSec]);
|
||||
}
|
||||
|
||||
// track last time share
|
||||
_lastShareTimes[shareData.worker] = now;
|
||||
_lastShareTimes[workerAddress] = now;
|
||||
}
|
||||
|
||||
/* Stores share diff, worker, and unique value with a score that is the timestamp. Unique value ensures it
|
||||
|
|
Loading…
Reference in New Issue