use of tech.pegasys.teku.networking.p2p.network.config.NetworkConfig.FilePrivateKeySource in project teku by ConsenSys.
the class P2POptionsTest method privateKeyFile_shouldBeSettable.
@Test
public void privateKeyFile_shouldBeSettable() {
TekuConfiguration tekuConfiguration = getTekuConfigurationFromArguments("--p2p-private-key-file", "/some/file");
assertThat(tekuConfiguration.network().getPrivateKeySource()).containsInstanceOf(FilePrivateKeySource.class);
assertThat(((FilePrivateKeySource) tekuConfiguration.network().getPrivateKeySource().get()).getFileName()).isEqualTo("/some/file");
assertThat(createConfigBuilder().network(b -> b.privateKeyFile("/some/file")).build()).usingRecursiveComparison().isEqualTo(tekuConfiguration);
}
use of tech.pegasys.teku.networking.p2p.network.config.NetworkConfig.FilePrivateKeySource in project teku by ConsenSys.
the class P2POptionsTest method shouldReadFromConfigurationFile.
@Test
public void shouldReadFromConfigurationFile() {
final TekuConfiguration tekuConfig = getTekuConfigurationFromFile("P2POptions_config.yaml");
final P2PConfig p2pConfig = tekuConfig.p2p();
assertThat(p2pConfig.getTargetSubnetSubscriberCount()).isEqualTo(5);
final DiscoveryConfig discoConfig = tekuConfig.discovery();
assertThat(discoConfig.isDiscoveryEnabled()).isTrue();
assertThat(discoConfig.getMinPeers()).isEqualTo(70);
assertThat(discoConfig.getMaxPeers()).isEqualTo(85);
assertThat(discoConfig.getMinRandomlySelectedPeers()).isEqualTo(1);
assertThat(discoConfig.getStaticPeers()).isEqualTo(List.of("127.1.0.1", "127.1.1.1"));
final NetworkConfig networkConfig = tekuConfig.network();
assertThat(networkConfig.isEnabled()).isTrue();
assertThat(networkConfig.getAdvertisedIp()).isEqualTo("127.200.0.1");
assertThat(networkConfig.getNetworkInterface()).isEqualTo("127.100.0.1");
assertThat(networkConfig.getListenPort()).isEqualTo(4321);
assertThat(networkConfig.getPrivateKeySource()).containsInstanceOf(FilePrivateKeySource.class);
assertThat(((FilePrivateKeySource) networkConfig.getPrivateKeySource().get()).getFileName()).isEqualTo("/the/file");
}
Aggregations