Skip to content

Commit

Permalink
Handle null genesis config
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>
  • Loading branch information
matthew1001 committed Jul 4, 2023
1 parent 12e38d2 commit 4b88158
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
import org.hyperledger.besu.config.GenesisConfigFile;
import org.hyperledger.besu.config.GenesisConfigOptions;
import org.hyperledger.besu.config.MergeConfigOptions;
import org.hyperledger.besu.config.StubGenesisConfigOptions;
import org.hyperledger.besu.consensus.qbft.pki.PkiBlockCreationConfiguration;
import org.hyperledger.besu.consensus.qbft.pki.PkiBlockCreationConfigurationProvider;
import org.hyperledger.besu.controller.BesuController;
Expand Down Expand Up @@ -2133,7 +2134,10 @@ private void issueOptionWarnings() {
"--remote-connections-max-percentage"));

// Check that block producer options work
if (!isMergeEnabled() && !genesisConfigOptions.isPoa()) {
if (!isMergeEnabled()
&& !(Optional.ofNullable(genesisConfigOptions)
.orElseGet(() -> new StubGenesisConfigOptions())
.isPoa())) {
CommandLineUtils.checkOptionDependencies(
logger,
commandLine,
Expand All @@ -2146,7 +2150,9 @@ private void issueOptionWarnings() {
"--miner-extra-data"));
}

if (!genesisConfigOptions.isPoa()) {
if (!Optional.ofNullable(genesisConfigOptions)
.orElseGet(() -> new StubGenesisConfigOptions())
.isPoa()) {
// Check that mining options are able to work
CommandLineUtils.checkOptionDependencies(
logger,
Expand Down

0 comments on commit 4b88158

Please sign in to comment.