Skip to content

Commit

Permalink
fix: handle failure to retrieve net_version when forking (trufflesu…
Browse files Browse the repository at this point in the history
  • Loading branch information
lbeder authored and v-stickykeys committed Feb 13, 2021
1 parent a3ab1fd commit 908ca69
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/forking/forked_blockchain.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,13 @@ ForkedBlockchain.prototype.initialize = async function(accounts, callback) {
const forkVersion = await new Promise((resolve, reject) => {
this.web3.eth.net.getId((err, version) => {
if (err) {
Error.captureStackTrace(err);
err.message = `The fork provider errored when checking net_version: ${err.message}`;
reject(err);
if (this.options.network_id) {
resolve(this.options.network_id);
} else {
Error.captureStackTrace(err);
err.message = `The fork provider errored when checking net_version: ${err.message}`;
reject(err);
}
} else {
resolve(version);
}
Expand Down

0 comments on commit 908ca69

Please sign in to comment.