Skip to content

Commit

Permalink
check if epochlength > --Xchain-pruning-blocks-retained and fail vali…
Browse files Browse the repository at this point in the history
…dation if it does(hyperledger#7963)

Signed-off-by: philosup <[email protected]>
  • Loading branch information
ilsup-yun authored and philosup committed Jan 21, 2025
1 parent 5933a2a commit 7b821ab
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -1588,13 +1588,23 @@ private void validateRpcWsOptions() {
}

private void validateChainDataPruningParams() {
if (unstableChainPruningOptions.getChainDataPruningEnabled()
&& unstableChainPruningOptions.getChainDataPruningBlocksRetained()
< unstableChainPruningOptions.getChainDataPruningBlocksRetainedLimit()) {
throw new ParameterException(
this.commandLine,
"--Xchain-pruning-blocks-retained must be >= "
+ unstableChainPruningOptions.getChainDataPruningBlocksRetainedLimit());
if (unstableChainPruningOptions.getChainDataPruningEnabled()) {
final GenesisConfigOptions genesisConfigOptions = readGenesisConfigOptions();
if (unstableChainPruningOptions.getChainDataPruningBlocksRetained()
< unstableChainPruningOptions.getChainDataPruningBlocksRetainedLimit()) {
throw new ParameterException(
this.commandLine,
"--Xchain-pruning-blocks-retained must be >= "
+ unstableChainPruningOptions.getChainDataPruningBlocksRetainedLimit());
} else if (genesisConfigOptions.isQbft()
&& unstableChainPruningOptions.getChainDataPruningBlocksRetained()
< genesisConfigOptions.getQbftConfigOptions().getEpochLength()) {
throw new ParameterException(
this.commandLine,
"--Xchain-pruning-blocks-retained must be >= epochlength("
+ genesisConfigOptions.getQbftConfigOptions().getEpochLength()
+ ") for QBFT networks");
}
}
}

Expand Down

0 comments on commit 7b821ab

Please sign in to comment.