Fixed block solutions not being reported
This commit is contained in:
parent
3db1b47199
commit
a4b087cec4
@ -289,9 +289,11 @@ Listen to pool events
|
|||||||
reward: 5000000000, //the number of satoshis received as payment for solving this block
|
reward: 5000000000, //the number of satoshis received as payment for solving this block
|
||||||
difficulty: 64, //stratum worker difficulty
|
difficulty: 64, //stratum worker difficulty
|
||||||
shareDiff: 78, //actual difficulty of the share
|
shareDiff: 78, //actual difficulty of the share
|
||||||
blockDiff: 3349 //difficulty for this block
|
blockDiff: 3349, //block difficulty adjusted for share padding
|
||||||
|
blockDiffActual: 3349 //actual difficulty for this block
|
||||||
|
|
||||||
//AAK the block solution - set if block was found
|
|
||||||
|
//AKA the block solution - set if block was found
|
||||||
blockHash: '110c0447171ad819dd181216d5d80f41e9218e25d833a2789cb8ba289a52eee4',
|
blockHash: '110c0447171ad819dd181216d5d80f41e9218e25d833a2789cb8ba289a52eee4',
|
||||||
|
|
||||||
//Exists if "emitInvalidBlockHashes" is set to true
|
//Exists if "emitInvalidBlockHashes" is set to true
|
||||||
|
|||||||
@ -71,7 +71,9 @@ var JobManager = module.exports = function JobManager(maxDifficulty, options){
|
|||||||
switch(options.coin.algorithm){
|
switch(options.coin.algorithm){
|
||||||
case 'keccak':
|
case 'keccak':
|
||||||
case 'blake':
|
case 'blake':
|
||||||
if (options.coin.normalHashing !== true)
|
if (options.coin.normalHashing === true)
|
||||||
|
return util.sha256d;
|
||||||
|
else
|
||||||
return util.sha256;
|
return util.sha256;
|
||||||
default:
|
default:
|
||||||
return util.sha256d;
|
return util.sha256d;
|
||||||
@ -82,13 +84,12 @@ var JobManager = module.exports = function JobManager(maxDifficulty, options){
|
|||||||
switch(options.coin.algorithm){
|
switch(options.coin.algorithm){
|
||||||
case 'keccak':
|
case 'keccak':
|
||||||
case 'blake':
|
case 'blake':
|
||||||
//if (options.coin.normalHashing !== true)
|
return function(d, nTime){
|
||||||
return function(d, nTime){
|
return util.reverseBuffer(util.sha256d(Buffer.concat([d, new Buffer(nTime, 'hex')])));
|
||||||
util.reverseBuffer(util.sha256d(Buffer.concat([d, new Buffer(nTime, 'hex')])));
|
};
|
||||||
};
|
|
||||||
default:
|
default:
|
||||||
return function(d){
|
return function(d){
|
||||||
util.reverseBuffer(util.sha256d(d));
|
return util.reverseBuffer(util.sha256d(d));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
@ -212,10 +213,12 @@ var JobManager = module.exports = function JobManager(maxDifficulty, options){
|
|||||||
maxDifficulty.toNumber() / headerBigNum.toNumber() :
|
maxDifficulty.toNumber() / headerBigNum.toNumber() :
|
||||||
maxDifficulty.div(headerBigNum).toNumber();
|
maxDifficulty.div(headerBigNum).toNumber();
|
||||||
|
|
||||||
|
var blockDiffAdjusted = maxDifficulty.toNumber() / job.target.toNumber();
|
||||||
|
|
||||||
//Check if share is a block candidate (matched network difficulty)
|
//Check if share is a block candidate (matched network difficulty)
|
||||||
if (job.target.ge(headerBigNum)){
|
if (job.target.ge(headerBigNum)){
|
||||||
blockHex = job.serializeBlock(headerBuffer, coinbaseBuffer).toString('hex');
|
blockHex = job.serializeBlock(headerBuffer, coinbaseBuffer).toString('hex');
|
||||||
blockHash = blockHasher(headerBuffer, nTime)
|
blockHash = blockHasher(headerBuffer, nTime).toString('hex');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (options.emitInvalidBlockHashes)
|
if (options.emitInvalidBlockHashes)
|
||||||
@ -253,7 +256,8 @@ var JobManager = module.exports = function JobManager(maxDifficulty, options){
|
|||||||
reward: job.rpcData.coinbasevalue,
|
reward: job.rpcData.coinbasevalue,
|
||||||
difficulty: difficulty,
|
difficulty: difficulty,
|
||||||
shareDiff: shareDiff,
|
shareDiff: shareDiff,
|
||||||
blockDiff : job.difficulty,
|
blockDiff : blockDiffAdjusted,
|
||||||
|
blockDiffActual: job.difficulty,
|
||||||
blockHash: blockHash,
|
blockHash: blockHash,
|
||||||
blockHashInvalid: blockHashInvalid
|
blockHashInvalid: blockHashInvalid
|
||||||
}, blockHex);
|
}, blockHex);
|
||||||
|
|||||||
@ -51,8 +51,6 @@ var pool = module.exports = function pool(options, authorizeFn){
|
|||||||
|
|
||||||
//Which number to use as dividend when converting difficulty to target
|
//Which number to use as dividend when converting difficulty to target
|
||||||
var maxDifficulty = algos[options.coin.algorithm].maxDiff;
|
var maxDifficulty = algos[options.coin.algorithm].maxDiff;
|
||||||
console.log(options.coin.name + ' ' + maxDifficulty.toString(16));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.start = function(){
|
this.start = function(){
|
||||||
@ -306,8 +304,6 @@ var pool = module.exports = function pool(options, authorizeFn){
|
|||||||
}
|
}
|
||||||
}).on('log', function(severity, message){
|
}).on('log', function(severity, message){
|
||||||
_this.emit('log', severity, message);
|
_this.emit('log', severity, message);
|
||||||
}).on('debugBlockShare', function(debugData) {
|
|
||||||
//emitLog(JSON.stringify(debugData));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -408,6 +408,7 @@ var StratumServer = exports.Server = function StratumServer(options, authorizeFn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
(function init(){
|
(function init(){
|
||||||
|
|
||||||
//Interval to look through bannedIPs for old bans and remove them in order to prevent a memory leak
|
//Interval to look through bannedIPs for old bans and remove them in order to prevent a memory leak
|
||||||
@ -450,7 +451,6 @@ var StratumServer = exports.Server = function StratumServer(options, authorizeFn
|
|||||||
}*/
|
}*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.getStratumClients = function () {
|
this.getStratumClients = function () {
|
||||||
return stratumClients;
|
return stratumClients;
|
||||||
};
|
};
|
||||||
@ -465,7 +465,7 @@ var StratumServer = exports.Server = function StratumServer(options, authorizeFn
|
|||||||
stratumClients[subId].manuallyAuthClient(clientObj.workerName, clientObj.workerPass);
|
stratumClients[subId].manuallyAuthClient(clientObj.workerName, clientObj.workerPass);
|
||||||
stratumClients[subId].manuallySetValues(clientObj);
|
stratumClients[subId].manuallySetValues(clientObj);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
StratumServer.prototype.__proto__ = events.EventEmitter.prototype;
|
StratumServer.prototype.__proto__ = events.EventEmitter.prototype;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user