diff --git a/lib/contracts/provider.js b/lib/contracts/provider.js index ad4345ed3..94a329c1e 100644 --- a/lib/contracts/provider.js +++ b/lib/contracts/provider.js @@ -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) {