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

Commit

Permalink
Add --ropsten command line argument
Browse files Browse the repository at this point in the history
  • Loading branch information
jvirtanen committed Oct 27, 2018
1 parent f0553ef commit 4423ba3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ public class DiscoveryConfiguration {
"enode://b6b28890b006743680c52e64e0d16db57f28124885595fa03a562be1d2bf0f3a1da297d56b13da25fb992888fd556d4c1a27b1f39d531bde7de1921c90061cc6@159.89.28.211:30303")
.map(DefaultPeer::fromURI)
.collect(toList()));
public static List<Peer> ROPSTEN_BOOTSTRAP_NODES =
Collections.unmodifiableList(
Stream.of(
"enode://6332792c4a00e3e4ee0926ed89e0d27ef985424d97b6a45bf0f23e51f0dcb5e66b875777506458aea7af6f9e4ffb69f43f3778ee73c81ed9d34c51c4b16b0b0f@52.232.243.152:30303",
"enode://94c15d1b9e2fe7ce56e458b9a3b672ef11894ddedd0c6f247e0f1d3487f52b66208fb4aeb8179fce6e3a749ea93ed147c37976d67af557508d199d9594c35f09@192.81.208.223:30303")
.map(DefaultPeer::fromURI)
.collect(toList()));

private boolean active = true;
private String bindHost = "0.0.0.0";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@

import static tech.pegasys.pantheon.controller.CliquePantheonController.RINKEBY_NETWORK_ID;
import static tech.pegasys.pantheon.controller.MainnetPantheonController.MAINNET_NETWORK_ID;
import static tech.pegasys.pantheon.controller.MainnetPantheonController.ROPSTEN_NETWORK_ID;
import static tech.pegasys.pantheon.ethereum.p2p.config.DiscoveryConfiguration.MAINNET_BOOTSTRAP_NODES;
import static tech.pegasys.pantheon.ethereum.p2p.config.DiscoveryConfiguration.RINKEBY_BOOTSTRAP_NODES;
import static tech.pegasys.pantheon.ethereum.p2p.config.DiscoveryConfiguration.ROPSTEN_BOOTSTRAP_NODES;

import java.net.URI;
import java.net.URISyntaxException;
Expand All @@ -28,6 +30,7 @@
public class EthNetworkConfig {
private static final String MAINNET_GENESIS = "mainnet.json";
private static final String RINKEBY_GENESIS = "rinkeby.json";
private static final String ROPSTEN_GENESIS = "ropsten.json";
private final URI genesisConfig;
private final int networkId;
private final Collection<?> bootNodes;
Expand Down Expand Up @@ -94,6 +97,11 @@ public static EthNetworkConfig rinkeby() {
return new EthNetworkConfig(genesisConfig, RINKEBY_NETWORK_ID, RINKEBY_BOOTSTRAP_NODES);
}

public static EthNetworkConfig ropsten() {
final URI genesisConfig = jsonConfigURI(ROPSTEN_GENESIS);
return new EthNetworkConfig(genesisConfig, ROPSTEN_NETWORK_ID, ROPSTEN_BOOTSTRAP_NODES);
}

private static URI jsonConfigURI(final String resourceName) {
try {
return Resources.getResource(resourceName).toURI();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ public static class RpcApisConversionException extends Exception {
)
private final Boolean rinkeby = false;

@Option(
names = {"--ropsten"},
description = "Use the Ropsten test network (default: ${DEFAULT-VALUE})"
)
private final Boolean ropsten = false;

@Option(
names = {"--p2p-listen"},
paramLabel = MANDATORY_HOST_AND_PORT_FORMAT_HELP,
Expand Down Expand Up @@ -563,7 +569,9 @@ private Path getDefaultPantheonDataDir() {

private EthNetworkConfig ethNetworkConfig() {
final EthNetworkConfig predefinedNetworkConfig =
rinkeby ? EthNetworkConfig.rinkeby() : EthNetworkConfig.mainnet();
rinkeby
? EthNetworkConfig.rinkeby()
: ropsten ? EthNetworkConfig.ropsten() : EthNetworkConfig.mainnet();
return updateNetworkConfig(predefinedNetworkConfig);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class MainnetPantheonController implements PantheonController<Void> {

private static final Logger LOG = LogManager.getLogger();
public static final int MAINNET_NETWORK_ID = 1;
public static final int ROPSTEN_NETWORK_ID = 3;

private final GenesisConfig<Void> genesisConfig;
private final ProtocolContext<Void> protocolContext;
Expand Down

0 comments on commit 4423ba3

Please sign in to comment.