Do not depend on getmininginfo to see network diff

This commit is contained in:
Matt 2014-03-19 15:20:06 -06:00
parent 131d24e192
commit ed75a50d11

View File

@ -287,23 +287,27 @@ var pool = module.exports = function pool(options, authorizeFn){
util.script_to_address(results.addressInfo.address) :
util.script_to_pubkey(results.addressInfo.pubkey);
var networkDifficulty = Math.round(results.miningInfo.difficulty * 65536);
//var networkDifficulty = Math.round(results.miningInfo.difficulty * 65536);
emitLog('network', 'Current block height at ' + results.miningInfo.blocks +
' with block difficulty of ' + networkDifficulty);
Object.keys(options.ports).forEach(function(port){
var portDiff = options.ports[port].diff;
if (portDiff > networkDifficulty)
emitWarningLog('system', 'diff of ' + portDiff + ' on port ' + port + ' was set higher' +
'than network difficulty of ' + networkDifficulty);
});
GetBlockTemplate(newDaemon, function(error, result){
if (error) {
emitErrorLog('system', 'Error with getblocktemplate on initializing');
cback(error);
} else {
var networkDifficulty = _this.jobManager.currentJob.difficulty;
emitLog('network', 'Current block height at ' + results.miningInfo.blocks +
' with block difficulty of ' + networkDifficulty);
Object.keys(options.ports).forEach(function(port){
var portDiff = options.ports[port].diff;
if (portDiff > networkDifficulty)
emitWarningLog('system', 'diff of ' + portDiff + ' on port ' + port +
' was set higher than network difficulty of ' + networkDifficulty);
});
cback(null, newDaemon); // finish!
}
});