@Test public void shouldGetChainIdWhenSpecified() { final GenesisConfigOptions config = fromConfigOptions(singletonMap("chainId", 32)); assertThat(config.getChainId()).hasValue(32); }
@Test public void predefinedNetworkIdsMustBeEqualToChainIds() { // check the network id against the one in mainnet genesis config // it implies that EthNetworkConfig.mainnet().getNetworkId() returns a value equals to the chain // id // in this network genesis file. GenesisConfigFile genesisConfigFile = GenesisConfigFile.fromConfig(EthNetworkConfig.getNetworkConfig(MAINNET).getGenesisConfig()); assertThat(genesisConfigFile.getConfigOptions().getChainId().isPresent()).isTrue(); assertThat(genesisConfigFile.getConfigOptions().getChainId().getAsInt()) .isEqualTo(EthNetworkConfig.getNetworkConfig(MAINNET).getNetworkId()); }
@Test public void shouldLoadDevelopmentConfigFile() { final GenesisConfigFile config = GenesisConfigFile.development(); // Sanity check some basic properties to confirm this is the dev file. assertThat(config.getConfigOptions().isEthHash()).isTrue(); assertThat(config.getConfigOptions().getChainId()).hasValue(DEVELOPMENT_CHAIN_ID); assertThat(config.getAllocations().map(GenesisAllocation::getAddress)) .contains( "fe3b557e8fb62b89f4916b721be55ceb828dbd73", "627306090abab3a6e1400e9345bc60c78a8bef57", "f17f52151ebef6c7334fad080c5704d77216b732"); }
@Test public void shouldLoadMainnetConfigFile() { final GenesisConfigFile config = GenesisConfigFile.mainnet(); // Sanity check some basic properties to confirm this is the mainnet file. assertThat(config.getConfigOptions().isEthHash()).isTrue(); assertThat(config.getConfigOptions().getChainId()).hasValue(MAINNET_CHAIN_ID); assertThat(config.getAllocations().map(GenesisAllocation::getAddress)) .contains( "000d836201318ec6899a67540690382780743280", "001762430ea9c3a26e5749afdb70da5f78ddbb8c", "001d14804b399c6ef80e64576f657660804fec0b"); }
genesisConfigFile .getConfigOptions() .getChainId() .orElse(EthNetworkConfig.getNetworkConfig(MAINNET).getNetworkId())); } catch (final DecodeException e) {
genesisConfig .getConfigOptions() .getChainId() .orElse(MainnetProtocolSchedule.DEFAULT_CHAIN_ID), fastSyncEnabled,