diff --git a/lib/daemon.js b/lib/daemon.js index 621e355..01f20f3 100644 --- a/lib/daemon.js +++ b/lib/daemon.js @@ -147,7 +147,11 @@ function DaemonInterface(options){ var itemFinished = function(error, result){ - var returnObj = {error: error, response: (result || {}).result, instance: instance}; + var returnObj = { + error: error, + response: (result || {}).result, + instance: instance + }; if (streamResults) callback(returnObj); else results.push(returnObj); diff --git a/lib/pool.js b/lib/pool.js index 150d491..ce52a01 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -306,6 +306,11 @@ var pool = module.exports = function pool(options, authorizeFn){ function SetupDaemonInterface(finishedCallback){ + if (options.daemons.length < 1){ + emitErrorLog('No daemons have been configured - pool cannot start'); + return; + } + _this.daemon = new daemon.interface(options.daemons); _this.daemon.once('online', function(){ @@ -331,7 +336,6 @@ var pool = module.exports = function pool(options, authorizeFn){ async.waterfall([ - function(callback){ _this.daemon.cmd('validateaddress', [options.address], function(results){ @@ -357,8 +361,7 @@ var pool = module.exports = function pool(options, authorizeFn){ return r.response.ismine; }); - callback(null, !!ownedInfo.length ? ownedInfo[0].response : results[0].response); - + callback(null, ownedInfo.length > 0 ? ownedInfo[0].response : results[0].response); }); }, @@ -509,9 +512,7 @@ var pool = module.exports = function pool(options, authorizeFn){ emitErrorLog('Could not start pool, ' + JSON.stringify(err)); return; } - finishedCallback(); - }); }