Skip to content

Commit

Permalink
full sync - don't fail startup if sync-min-peers specified (#6373)
Browse files Browse the repository at this point in the history
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
  • Loading branch information
macfarla authored Jan 9, 2024
1 parent c88571e commit 331833b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 5 additions & 5 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static org.hyperledger.besu.cli.config.NetworkName.MAINNET;
import static org.hyperledger.besu.cli.util.CommandLineUtils.DEPENDENCY_WARNING_MSG;
import static org.hyperledger.besu.cli.util.CommandLineUtils.DEPRECATION_WARNING_MSG;
import static org.hyperledger.besu.cli.util.CommandLineUtils.isOptionSet;
import static org.hyperledger.besu.controller.BesuController.DATABASE_PATH;
import static org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration.DEFAULT_GRAPHQL_HTTP_PORT;
import static org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration.DEFAULT_ENGINE_JSON_RPC_PORT;
Expand Down Expand Up @@ -2027,11 +2028,10 @@ private void issueOptionWarnings() {
"--p2p-port",
"--remote-connections-max-percentage"));

CommandLineUtils.failIfOptionDoesntMeetRequirement(
commandLine,
"--fast-sync-min-peers can't be used with FULL sync-mode",
!SyncMode.isFullSync(getDefaultSyncModeIfNotSet()),
singletonList("--fast-sync-min-peers"));
if (SyncMode.isFullSync(getDefaultSyncModeIfNotSet())
&& isOptionSet(commandLine, "--sync-min-peers")) {
logger.warn("--sync-min-peers is ignored in FULL sync-mode");
}

CommandLineUtils.failIfOptionDoesntMeetRequirement(
commandLine,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5066,8 +5066,7 @@ public void logsSuggestInstallingJemallocWhenEnvVarNotPresent() {
@Test
public void logWarnIfFastSyncMinPeersUsedWithFullSync() {
parseCommand("--sync-mode", "FULL", "--fast-sync-min-peers", "1");
assertThat(commandErrorOutput.toString(UTF_8))
.contains("--fast-sync-min-peers can't be used with FULL sync-mode");
verify(mockLogger).warn("--sync-min-peers is ignored in FULL sync-mode");
}

@Test
Expand Down

0 comments on commit 331833b

Please sign in to comment.