fix account selection when it isn't configured; improve error message on tests

This commit is contained in:
Iuri Matias 2017-03-04 21:51:28 -05:00
parent fd6af8af2e
commit a797f8fcf6
3 changed files with 13 additions and 4 deletions

View File

@ -54,7 +54,8 @@ DeployManager.prototype.deployContracts = function(done) {
if (err) {
return callback(new Error(err));
}
var selectedAccount = self.config.blockchainConfig.account.address;
var accountConfig = self.config.blockchainConfig.account;
var selectedAccount = accountConfig && accountConfig.address;
web3.eth.defaultAccount = (selectedAccount || accounts[0]);
callback(null, contractsManager, web3);
});

View File

@ -44,7 +44,8 @@ Engine.prototype.startService = function(serviceName, _options) {
throw new Error("unknown service: " + serviceName);
}
this.logger.trace("calling: " + serviceName + "(" + JSON.stringify(options) + ")");
// need to be careful with circular references due to passing the web3 object
//this.logger.trace("calling: " + serviceName + "(" + JSON.stringify(options) + ")");
return service.apply(this, [options]);
};

View File

@ -74,13 +74,20 @@ Test.prototype.deployAll = function(contractsConfig, cb) {
self.engine.events.on('abi-contracts-vanila', function(vanillaABI) {
callback(null, vanillaABI);
});
self.engine.deployManager.deployContracts(function() {
self.engine.deployManager.deployContracts(function(err, result) {
if (err) {
console.log(err);
callback(err);
}
});
}
], function(err, result) {
if (err) {
throw new Error(err);
console.log("got error");
process.exit();
}
// this should be part of the waterfall and not just something done at the
// end
self.web3.eth.getAccounts(function(err, accounts) {
if (err) {
throw new Error(err);