From b3dc4d2b7eb1d17391660b417177e689c64bca4d Mon Sep 17 00:00:00 2001 From: Adrian Sutton Date: Thu, 21 Feb 2019 07:19:24 +1000 Subject: [PATCH] Actually use the network ID is MainnetPantheonController (#929) --- .../pantheon/controller/MainnetPantheonController.java | 7 ++----- .../pegasys/pantheon/controller/PantheonController.java | 1 + .../src/test/java/tech/pegasys/pantheon/RunnerTest.java | 4 ++++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pantheon/src/main/java/tech/pegasys/pantheon/controller/MainnetPantheonController.java b/pantheon/src/main/java/tech/pegasys/pantheon/controller/MainnetPantheonController.java index add89d5ad2..47fc045912 100644 --- a/pantheon/src/main/java/tech/pegasys/pantheon/controller/MainnetPantheonController.java +++ b/pantheon/src/main/java/tech/pegasys/pantheon/controller/MainnetPantheonController.java @@ -33,7 +33,6 @@ import tech.pegasys.pantheon.ethereum.eth.sync.state.SyncState; import tech.pegasys.pantheon.ethereum.eth.transactions.TransactionPoolFactory; import tech.pegasys.pantheon.ethereum.mainnet.MainnetBlockHeaderValidator; -import tech.pegasys.pantheon.ethereum.mainnet.MainnetProtocolSchedule; import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSchedule; import tech.pegasys.pantheon.ethereum.p2p.api.ProtocolManager; import tech.pegasys.pantheon.ethereum.p2p.config.SubProtocolConfiguration; @@ -92,6 +91,7 @@ public static PantheonController init( final ProtocolSchedule protocolSchedule, final SynchronizerConfiguration syncConfig, final MiningParameters miningParams, + final int networkId, final KeyPair nodeKeys, final PrivacyParameters privacyParameters, final Path dataDirectory, @@ -108,10 +108,7 @@ public static PantheonController init( new EthProtocolManager( blockchain, protocolContext.getWorldStateArchive(), - genesisConfig - .getConfigOptions() - .getChainId() - .orElse(MainnetProtocolSchedule.DEFAULT_CHAIN_ID), + networkId, fastSyncEnabled, syncConfig.downloaderParallelism(), syncConfig.transactionsParallelism(), diff --git a/pantheon/src/main/java/tech/pegasys/pantheon/controller/PantheonController.java b/pantheon/src/main/java/tech/pegasys/pantheon/controller/PantheonController.java index eb9f14f870..dfe565efde 100644 --- a/pantheon/src/main/java/tech/pegasys/pantheon/controller/PantheonController.java +++ b/pantheon/src/main/java/tech/pegasys/pantheon/controller/PantheonController.java @@ -62,6 +62,7 @@ static PantheonController fromConfig( MainnetProtocolSchedule.fromConfig(configOptions, privacyParameters), syncConfig, miningParameters, + networkId, nodeKeys, privacyParameters, dataDirectory, diff --git a/pantheon/src/test/java/tech/pegasys/pantheon/RunnerTest.java b/pantheon/src/test/java/tech/pegasys/pantheon/RunnerTest.java index 01c21bb65c..aadfeddd93 100644 --- a/pantheon/src/test/java/tech/pegasys/pantheon/RunnerTest.java +++ b/pantheon/src/test/java/tech/pegasys/pantheon/RunnerTest.java @@ -94,6 +94,7 @@ private void syncFromGenesis(final SyncMode mode) throws Exception { final SynchronizerConfiguration syncConfigAhead = SynchronizerConfiguration.builder().syncMode(SyncMode.FULL).build(); final MetricsSystem noOpMetricsSystem = new NoOpMetricsSystem(); + final int networkId = 2929; // Setup state with block data try (final PantheonController controller = @@ -103,6 +104,7 @@ private void syncFromGenesis(final SyncMode mode) throws Exception { MainnetProtocolSchedule.create(), syncConfigAhead, new MiningParametersTestBuilder().enabled(false).build(), + networkId, aheadDbNodeKeys, PrivacyParameters.noPrivacy(), dataDirAhead, @@ -118,6 +120,7 @@ private void syncFromGenesis(final SyncMode mode) throws Exception { MainnetProtocolSchedule.create(), syncConfigAhead, new MiningParametersTestBuilder().enabled(false).build(), + networkId, aheadDbNodeKeys, PrivacyParameters.noPrivacy(), dataDirAhead, @@ -171,6 +174,7 @@ private void syncFromGenesis(final SyncMode mode) throws Exception { MainnetProtocolSchedule.create(), syncConfigBehind, new MiningParametersTestBuilder().enabled(false).build(), + networkId, KeyPair.generate(), PrivacyParameters.noPrivacy(), dataDirBehind,