Update testnet detection (#4746)

This commit is contained in:
Jaco Greeff 2017-03-03 19:49:46 +01:00 committed by Gav Wood
parent ec0e8f9dd6
commit 9b6170a37b
3 changed files with 11 additions and 8 deletions

View File

@ -37,10 +37,11 @@ export const setIsTestnet = (isTestnet) => ({ type: 'set isTestnet', isTestnet }
export const fetchIsTestnet = () => (dispatch) => export const fetchIsTestnet = () => (dispatch) =>
api.net.version() api.net.version()
.then((netVersion) => { .then((netVersion) => {
dispatch(setIsTestnet( dispatch(setIsTestnet([
netVersion === '2' || // morden '2', // morden
netVersion === '3' // ropsten '3', // ropsten
)); '42' // kovan
].includes(netVersion)));
}) })
.catch((err) => { .catch((err) => {
console.error('could not check if testnet'); console.error('could not check if testnet');

View File

@ -122,7 +122,7 @@ export function attachInstances () {
.then(([registryAddress, netChain]) => { .then(([registryAddress, netChain]) => {
const registry = api.newContract(abis.registry, registryAddress).instance; const registry = api.newContract(abis.registry, registryAddress).instance;
isTest = ['morden', 'ropsten', 'testnet'].includes(netChain); isTest = ['kovan', 'morden', 'ropsten', 'testnet'].includes(netChain);
console.log(`contract was found at registry=${registryAddress}`); console.log(`contract was found at registry=${registryAddress}`);
console.log(`running on ${netChain}, isTest=${isTest}`); console.log(`running on ${netChain}, isTest=${isTest}`);

View File

@ -290,9 +290,11 @@ export default class Status {
.then(([ .then(([
netPeers, clientVersion, netVersion, defaultExtraData, netChain, netPort, rpcSettings, enode, upgradeStatus netPeers, clientVersion, netVersion, defaultExtraData, netChain, netPort, rpcSettings, enode, upgradeStatus
]) => { ]) => {
const isTest = const isTest = [
netVersion === '2' || // morden '2', // morden
netVersion === '3'; // ropsten '3', // ropsten
'42' // kovan
].includes(netVersion);
const longStatus = { const longStatus = {
netPeers, netPeers,