Skip to content

Commit

Permalink
[MINOR] add genesis file name to config overview (hyperledger#6297)
Browse files Browse the repository at this point in the history
* add genesis file name to config overview

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

---------

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
Signed-off-by: jflo <justin+github@florentine.us>
  • Loading branch information
macfarla authored and jflo committed Dec 18, 2023
1 parent 0d1ca27 commit aecffa7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Add error messages on authentication failures with username and password [#6212](https://github.com/hyperledger/besu/pull/6212)
- New `Sequenced` transaction pool. The pool is an evolution of the `legacy` pool and is likely to be more suitable to enterprise or permissioned chains than the `layered` transaction pool. Select to use this pool with `--tx-pool=sequenced`. Supports the same options as the `legacy` pool [#6211](https://github.com/hyperledger/besu/issues/6211)
- Set Ethereum Classic mainnet activation block for Spiral network upgrade [#6267](https://github.com/hyperledger/besu/pull/6267)
- Add custom genesis file name to config overview if specified [#6297](https://github.com/hyperledger/besu/pull/6297)

### Bug fixes

Expand Down
3 changes: 3 additions & 0 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -3526,6 +3526,9 @@ private String generateConfigurationOverview() {
}

builder.setHasCustomGenesis(genesisFile != null);
if (genesisFile != null) {
builder.setCustomGenesis(genesisFile.getAbsolutePath());
}
builder.setNetworkId(ethNetworkConfig.getNetworkId());

builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class ConfigurationOverviewBuilder {
private String network;
private BigInteger networkId;
private boolean hasCustomGenesis;
private String customGenesisFileName;
private String dataStorage;
private String syncMode;
private Integer rpcPort;
Expand Down Expand Up @@ -98,6 +99,17 @@ public ConfigurationOverviewBuilder setHasCustomGenesis(final boolean hasCustomG
return this;
}

/**
* Sets location of custom genesis file specified.
*
* @param customGenesisFileName the filename of the custom genesis file, only set if specified
* @return the builder
*/
public ConfigurationOverviewBuilder setCustomGenesis(final String customGenesisFileName) {
this.customGenesisFileName = customGenesisFileName;
return this;
}

/**
* Sets data storage.
*
Expand Down Expand Up @@ -269,7 +281,9 @@ public String build() {
}

if (hasCustomGenesis) {
lines.add("Network: Custom genesis file specified");
lines.add("Network: Custom genesis file");
lines.add(
customGenesisFileName == null ? "Custom genesis file is null" : customGenesisFileName);
}

if (networkId != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ void setGenesisFile() {
assertThat(networkSet).contains("Network: foobar");

builder.setHasCustomGenesis(true);
builder.setCustomGenesis("file.name");
final String genesisSet = builder.build();
assertThat(genesisSet).contains("Network: Custom genesis file specified");
assertThat(genesisSet).contains("Network: Custom genesis file");
assertThat(genesisSet).doesNotContain("Network: foobar");
}

Expand Down

0 comments on commit aecffa7

Please sign in to comment.