Skip to content

Commit

Permalink
Rework 'isEthash' logic
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 10, 2023
1 parent 5add7ee commit 137d4db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
15 changes: 2 additions & 13 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -2113,15 +2113,6 @@ private GenesisConfigOptions readGenesisConfigOptions() {
return genesisConfigOptions;
}

private boolean isEthashEnabled() {
if (genesisFile == null) {
return GenesisConfigFile.fromConfig(ethNetworkConfig.getGenesisConfig())
.getConfigOptions()
.isEthHash();
}
return genesisConfigOptions.isEthHash();
}

private void issueOptionWarnings() {

// Check that P2P options are able to work
Expand All @@ -2142,7 +2133,7 @@ private void issueOptionWarnings() {
"--remote-connections-max-percentage"));

// Check that block producer options work
if (!isMergeEnabled() && isEthashEnabled()) {
if (!isMergeEnabled() && getActualGenesisConfigOptions().isEthHash()) {
CommandLineUtils.checkOptionDependencies(
logger,
commandLine,
Expand All @@ -2153,10 +2144,8 @@ private void issueOptionWarnings() {
"--min-gas-price",
"--min-block-occupancy-ratio",
"--miner-extra-data"));
}

// Check that mining options are able to work
if (!isMergeEnabled() && isEthashEnabled()) {
// Check that mining options are able to work
CommandLineUtils.checkOptionDependencies(
logger,
commandLine,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3684,7 +3684,7 @@ public void stratumMiningIsEnabledWhenSpecified() throws Exception {
@Test
public void stratumMiningOptionsRequiresServiceToBeEnabled() {

parseCommand("--miner-stratum-enabled");
parseCommand("--network", "dev", "--miner-stratum-enabled");

verifyOptionsConstraintLoggerCall("--miner-enabled", "--miner-stratum-enabled");

Expand All @@ -3698,7 +3698,7 @@ public void stratumMiningOptionsRequiresServiceToBeEnabled() {
public void stratumMiningOptionsRequiresServiceToBeEnabledToml() throws IOException {
final Path toml = createTempFile("toml", "miner-stratum-enabled=true\n");

parseCommand("--config-file", toml.toString());
parseCommand("--network", "dev", "--config-file", toml.toString());

verifyOptionsConstraintLoggerCall("--miner-enabled", "--miner-stratum-enabled");

Expand Down

0 comments on commit 137d4db

Please sign in to comment.