Add Mainnet to merged networks (#4463)

* Add Mainnet to the merged networks, to force fast-sync-min-peers to 1

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
pull/4467/head
Fabio Di Fabio 2 years ago committed by GitHub
parent 10e72bb99d
commit cbe6306a34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 1
      besu/src/main/java/org/hyperledger/besu/cli/config/NetworkName.java
  3. 22
      besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java

@ -5,6 +5,7 @@
### Additions and Improvements ### Additions and Improvements
- Avoid sending added block events to transaction pool, and processing incoming transactions during initial sync [#4457](https://github.com/hyperledger/besu/pull/4457) - Avoid sending added block events to transaction pool, and processing incoming transactions during initial sync [#4457](https://github.com/hyperledger/besu/pull/4457)
- When building a new proposal, keep the best block built until now instead of the last one [#4455](https://github.com/hyperledger/besu/pull/4455) - When building a new proposal, keep the best block built until now instead of the last one [#4455](https://github.com/hyperledger/besu/pull/4455)
- Add Mainnet to merged networks [#4463](https://github.com/hyperledger/besu/pull/4463)
### Bug Fixes ### Bug Fixes
### Download Links ### Download Links

@ -89,6 +89,7 @@ public enum NetworkName {
public static boolean isMergedNetwork(final NetworkName networkName) { public static boolean isMergedNetwork(final NetworkName networkName) {
switch (networkName) { switch (networkName) {
case MAINNET:
case GOERLI: case GOERLI:
case ROPSTEN: case ROPSTEN:
case SEPOLIA: case SEPOLIA:

@ -882,7 +882,7 @@ public class BesuCommandTest extends CommandTestAbstract {
final SynchronizerConfiguration syncConfig = syncConfigurationCaptor.getValue(); final SynchronizerConfiguration syncConfig = syncConfigurationCaptor.getValue();
assertThat(syncConfig.getSyncMode()).isEqualTo(SyncMode.FAST); assertThat(syncConfig.getSyncMode()).isEqualTo(SyncMode.FAST);
assertThat(syncConfig.getFastSyncMinimumPeerCount()).isEqualTo(5); assertThat(syncConfig.getFastSyncMinimumPeerCount()).isEqualTo(1);
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty(); assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
@ -1709,19 +1709,19 @@ public class BesuCommandTest extends CommandTestAbstract {
} }
@Test @Test
public void checkValidDefaultFastSyncMinPeersOption() { public void checkValidDefaultFastSyncMinPeersPoS() {
parseCommand("--sync-mode", "FAST"); parseCommand("--sync-mode", "FAST", "--network", "MAINNET");
verify(mockControllerBuilder).synchronizerConfiguration(syncConfigurationCaptor.capture()); verify(mockControllerBuilder).synchronizerConfiguration(syncConfigurationCaptor.capture());
final SynchronizerConfiguration syncConfig = syncConfigurationCaptor.getValue(); final SynchronizerConfiguration syncConfig = syncConfigurationCaptor.getValue();
assertThat(syncConfig.getSyncMode()).isEqualTo(SyncMode.FAST); assertThat(syncConfig.getSyncMode()).isEqualTo(SyncMode.FAST);
assertThat(syncConfig.getFastSyncMinimumPeerCount()).isEqualTo(5); assertThat(syncConfig.getFastSyncMinimumPeerCount()).isEqualTo(1);
assertThat(commandOutput.toString(UTF_8)).isEmpty(); assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty(); assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
} }
@Test @Test
public void checkValidDefaultFastSyncMinPeersPreMergeOption() { public void checkValidDefaultFastSyncMinPeersPoW() {
parseCommand("--sync-mode", "FAST", "--network", "CLASSIC"); parseCommand("--sync-mode", "FAST", "--network", "CLASSIC");
verify(mockControllerBuilder).synchronizerConfiguration(syncConfigurationCaptor.capture()); verify(mockControllerBuilder).synchronizerConfiguration(syncConfigurationCaptor.capture());
@ -1732,18 +1732,6 @@ public class BesuCommandTest extends CommandTestAbstract {
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty(); assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
} }
@Test
public void checkValidDefaultFastSyncMinPeersPostMergeOption() {
parseCommand("--sync-mode", "FAST", "--network", "GOERLI");
verify(mockControllerBuilder).synchronizerConfiguration(syncConfigurationCaptor.capture());
final SynchronizerConfiguration syncConfig = syncConfigurationCaptor.getValue();
assertThat(syncConfig.getSyncMode()).isEqualTo(SyncMode.FAST);
assertThat(syncConfig.getFastSyncMinimumPeerCount()).isEqualTo(1);
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
@Test @Test
public void parsesValidFastSyncMinPeersOption() { public void parsesValidFastSyncMinPeersOption() {
parseCommand("--sync-mode", "FAST", "--fast-sync-min-peers", "11"); parseCommand("--sync-mode", "FAST", "--fast-sync-min-peers", "11");

Loading…
Cancel
Save