@@ -2705,4 +2705,43 @@ void helpOutputShouldDisplayCorrectDefaultValues() {
2705
2705
2706
2706
assertThat (errorOutputString ).isEmpty ();
2707
2707
}
2708
+
2709
+ @ Test
2710
+ void chainPruningEnabledWithQBFTShouldFailWhenChainPruningBlocksRetainedValueLessThanEpochLength ()
2711
+ throws IOException {
2712
+
2713
+ JsonObject genesis = GENESIS_VALID_JSON ;
2714
+ genesis .getJsonObject ("config" ).put ("qbft" , new JsonObject ().put ("epochlength" , 30000 ));
2715
+
2716
+ final Path genesisFile = createFakeGenesisFile (genesis );
2717
+
2718
+ parseCommand (
2719
+ "--genesis-file" ,
2720
+ genesisFile .toString (),
2721
+ "--Xchain-pruning-enabled=true" ,
2722
+ "--Xchain-pruning-blocks-retained=7200" ,
2723
+ "--version-compatibility-protection=false" );
2724
+
2725
+ assertThat (commandErrorOutput .toString (UTF_8 ))
2726
+ .contains (
2727
+ "--Xchain-pruning-blocks-retained must be >= epochlength(30000) for QBFT networks" );
2728
+ }
2729
+
2730
+ @ Test
2731
+ void chainPruningEnabledWithQBFT () throws IOException {
2732
+
2733
+ JsonObject genesis = GENESIS_VALID_JSON ;
2734
+ genesis .getJsonObject ("config" ).put ("qbft" , new JsonObject ().put ("epochlength" , 30000 ));
2735
+
2736
+ final Path genesisFile = createFakeGenesisFile (genesis );
2737
+
2738
+ parseCommand (
2739
+ "--genesis-file" ,
2740
+ genesisFile .toString (),
2741
+ "--Xchain-pruning-enabled=true" ,
2742
+ "--Xchain-pruning-blocks-retained=30000" ,
2743
+ "--version-compatibility-protection=false" );
2744
+
2745
+ assertThat (commandErrorOutput .toString (UTF_8 )).isEmpty ();
2746
+ }
2708
2747
}
0 commit comments