Added check for missing daemon config

This commit is contained in:
Matt 2014-04-08 11:38:36 -06:00
parent eed16e0f2e
commit 86a4c05429
2 changed files with 11 additions and 6 deletions

View File

@ -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);

View File

@ -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();
});
}