From 942b4307449fbc4e504fa8a8635394ad06fb3f35 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) Signed-off-by: Adrian Sutton --- .../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.SynchronizerConfiguration; 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 class MainnetPantheonController implements PantheonController { 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 class MainnetPantheonController implements PantheonController { 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 @@ public interface PantheonController extends Closeable { 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 @@ public final class RunnerTest { 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 @@ public final class RunnerTest { MainnetProtocolSchedule.create(), syncConfigAhead, new MiningParametersTestBuilder().enabled(false).build(), + networkId, aheadDbNodeKeys, PrivacyParameters.noPrivacy(), dataDirAhead, @@ -118,6 +120,7 @@ public final class RunnerTest { MainnetProtocolSchedule.create(), syncConfigAhead, new MiningParametersTestBuilder().enabled(false).build(), + networkId, aheadDbNodeKeys, PrivacyParameters.noPrivacy(), dataDirAhead, @@ -171,6 +174,7 @@ public final class RunnerTest { MainnetProtocolSchedule.create(), syncConfigBehind, new MiningParametersTestBuilder().enabled(false).build(), + networkId, KeyPair.generate(), PrivacyParameters.noPrivacy(), dataDirBehind,