Do not depend on getmininginfo to see network diff
This commit is contained in:
parent
131d24e192
commit
ed75a50d11
24
lib/pool.js
24
lib/pool.js
@ -287,23 +287,27 @@ var pool = module.exports = function pool(options, authorizeFn){
|
|||||||
util.script_to_address(results.addressInfo.address) :
|
util.script_to_address(results.addressInfo.address) :
|
||||||
util.script_to_pubkey(results.addressInfo.pubkey);
|
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){
|
GetBlockTemplate(newDaemon, function(error, result){
|
||||||
if (error) {
|
if (error) {
|
||||||
emitErrorLog('system', 'Error with getblocktemplate on initializing');
|
emitErrorLog('system', 'Error with getblocktemplate on initializing');
|
||||||
cback(error);
|
cback(error);
|
||||||
} else {
|
} 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!
|
cback(null, newDaemon); // finish!
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user