Minor logging improvements

This commit is contained in:
Matt 2014-02-27 00:25:23 -07:00
parent 0f38fd5549
commit 2d1b23ddb8

View File

@ -36,6 +36,7 @@ var pool = module.exports = function pool(options, authorizeFn){
var emitErrorLog = function(key, text) { _this.emit('log', 'error' , key, text); }; var emitErrorLog = function(key, text) { _this.emit('log', 'error' , key, text); };
this.start = function(){ this.start = function(){
emitLog('system', 'Starting pool for ' + options.name + ' [' + options.symbol.toUpperCase() + ']');
SetupJobManager(); SetupJobManager();
SetupVarDiff(); SetupVarDiff();
SetupDaemonInterface(); SetupDaemonInterface();
@ -203,6 +204,12 @@ var pool = module.exports = function pool(options, authorizeFn){
return b.blocks - a.blocks; return b.blocks - a.blocks;
})[0]; })[0];
if (options.varDiff.enabled)
_this.varDiff.setNetworkDifficulty(largestHeight.difficulty);
emitLog('network', 'Current block height at ' + largestHeight.blocks +
' with difficulty of ' + largestHeight.difficulty);
callback(null, largestHeight); callback(null, largestHeight);
} }
else{ else{
@ -228,13 +235,10 @@ var pool = module.exports = function pool(options, authorizeFn){
return; return;
} }
emitLog('system','Connected to daemon'); emitLog('system','Connected to daemon via RPC');
options.hasSubmitMethod = results.submitMethod; options.hasSubmitMethod = results.submitMethod;
if (options.varDiff.enabled)
_this.varDiff.setNetworkDifficulty(results.miningInfo.difficulty);
if (options.reward === 'POS' && typeof(results.addressInfo.pubkey) == 'undefined') { if (options.reward === 'POS' && typeof(results.addressInfo.pubkey) == 'undefined') {
// address provided is not of the wallet. // address provided is not of the wallet.
emitErrorLog('system', 'The address provided is not from the daemon wallet.'); emitErrorLog('system', 'The address provided is not from the daemon wallet.');