fix webserver errors

This commit is contained in:
Jonathan Rainville 2018-07-06 14:43:01 -04:00 committed by Pascal Precht
parent 62c46063b3
commit 7e16691aa6
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 15 additions and 3 deletions

View File

@ -58,6 +58,7 @@ class Provider {
self.accounts = AccountParser.parseAccountsConfig(self.accountsConfig, self.web3, self.logger);
self.addresses = [];
if (!self.accounts.length) {
return callback();
}
@ -75,20 +76,31 @@ class Provider {
return new Promise((resolve, reject) => {
self.realAccountFunction((err, accounts) => {
if (err) {
cb(err);
return reject(err);
return cb(err);
}
accounts = accounts.concat(self.addresses);
// accounts = self.addresses.concat(accounts);
cb(null, accounts);
resolve(accounts);
});
});
}
realSend(payload, cb);
};
callback();
}
stop() {
if (this.provider && this.provider.removeAllListeners) {
this.provider.removeAllListeners('connect');
this.provider.removeAllListeners('error');
this.provider.removeAllListeners('end');
this.provider.removeAllListeners('data');
this.provider.responseCallbacks = {};
this.provider = null;
}
}
fundAccounts(callback) {
const self = this;
if (!self.accounts.length) {