Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Edit network id check #1528

Merged
merged 2 commits into from
Dec 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions packages/truffle-core/lib/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,14 @@ const Environment = {

async function detectNetworkId() {
const providerNetworkId = await web3.eth.net.getId();
if (network_id != "*") {
if (network_id !== "*") {
// Ensure the network id matches the one in the config for safety
if (providerNetworkId !== network_id) {
const error = {
message:
`The network id specified in the truffle config ` +
`(${network_id}) does not match the one returned by the network ` +
`(${providerNetworkId}). Ensure that both the network and the ` +
`provider are properly configured.`
};
if (providerNetworkId.toString() !== network_id.toString()) {
const error =
`The network id specified in the truffle config ` +
`(${network_id}) does not match the one returned by the network ` +
`(${providerNetworkId}). Ensure that both the network and the ` +
`provider are properly configured.`;
throw new Error(error);
}
return network_id;
Expand Down