Fix running ATs with in-process node runner (#1285)

Supplies an EthereumWireProtocolConfiguration when creating PantheonController.
Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
Adrian Sutton 6 years ago committed by GitHub
parent 817a7b2429
commit 31a5437080
  1. 2
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/ThreadPantheonNodeRunner.java
  2. 13
      pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonControllerBuilder.java

@ -20,6 +20,7 @@ import tech.pegasys.pantheon.cli.EthNetworkConfig;
import tech.pegasys.pantheon.cli.PantheonControllerBuilder;
import tech.pegasys.pantheon.controller.KeyPairUtil;
import tech.pegasys.pantheon.controller.PantheonController;
import tech.pegasys.pantheon.ethereum.eth.EthereumWireProtocolConfiguration;
import tech.pegasys.pantheon.ethereum.eth.sync.SynchronizerConfiguration;
import tech.pegasys.pantheon.ethereum.eth.transactions.PendingTransactions;
import tech.pegasys.pantheon.metrics.MetricsSystem;
@ -76,6 +77,7 @@ public class ThreadPantheonNodeRunner implements PantheonNodeRunner {
.metricsSystem(noOpMetricsSystem)
.maxPendingTransactions(PendingTransactions.MAX_PENDING_TRANSACTIONS)
.rocksDbConfiguration(new RocksDbConfiguration.Builder().databaseDir(tempDir).build())
.ethereumWireProtocolConfiguration(EthereumWireProtocolConfiguration.defaultConfig())
.build();
} catch (final IOException e) {
throw new RuntimeException("Error building PantheonController", e);

@ -12,6 +12,7 @@
*/
package tech.pegasys.pantheon.cli;
import static com.google.common.base.Preconditions.checkNotNull;
import static tech.pegasys.pantheon.controller.KeyPairUtil.loadKeyPair;
import tech.pegasys.pantheon.config.GenesisConfigFile;
@ -105,6 +106,16 @@ public class PantheonControllerBuilder {
}
public PantheonController<?> build() throws IOException {
checkNotNull(nodePrivateKeyFile, "Missing node private key file");
checkNotNull(synchronizerConfiguration, "Missing synchronizer configuration");
checkNotNull(rocksDbConfiguration, "Missing rocksdb configuration");
checkNotNull(homePath, "Missing home path");
checkNotNull(ethNetworkConfig, "Missing Ethereum network config");
checkNotNull(miningParameters, "Missing mining parameters");
checkNotNull(metricsSystem, "Missing metrics system");
checkNotNull(privacyParameters, "Missing privacy parameters");
checkNotNull(ethereumWireProtocolConfiguration, "Missing Ethereum wire protocol config");
// instantiate a controller with mainnet config if no genesis file is defined
// otherwise use the indicated genesis file
final KeyPair nodeKeys = loadKeyPair(nodePrivateKeyFile);
@ -120,7 +131,7 @@ public class PantheonControllerBuilder {
final String genesisConfig = ethNetworkConfig.getGenesisConfig();
genesisConfigFile = GenesisConfigFile.fromConfig(genesisConfig);
}
Clock clock = Clock.systemUTC();
final Clock clock = Clock.systemUTC();
return PantheonController.fromConfig(
genesisConfigFile,
synchronizerConfiguration,

Loading…
Cancel
Save