File tree Expand file tree Collapse file tree 2 files changed +25
-12
lines changed
Expand file tree Collapse file tree 2 files changed +25
-12
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,12 @@ pub struct AlephCli {
4040 /// BEHAVIOUR AND PUNISHED ACCORDINGLY!
4141 #[ clap( long, default_value_t = 20 ) ]
4242 max_nonfinalized_blocks : u32 ,
43+
44+ /// Experimental flag, allows pruning
45+ ///
46+ /// TURNING THIS FLAG ON, CAN LEAD TO MALICIOUS BEHAVIOUR AND CAN BE PUNISHED ACCORDINGLY!
47+ #[ clap( long, default_value_t = false ) ]
48+ experimental_pruning : bool ,
4349}
4450
4551impl AlephCli {
@@ -69,4 +75,8 @@ impl AlephCli {
6975 }
7076 self . max_nonfinalized_blocks
7177 }
78+
79+ pub fn experimental_pruning ( & self ) -> bool {
80+ self . experimental_pruning
81+ }
7282}
Original file line number Diff line number Diff line change @@ -10,18 +10,21 @@ use sc_service::PartialComponents;
1010
1111fn main ( ) -> sc_cli:: Result < ( ) > {
1212 let mut cli = Cli :: parse ( ) ;
13-
14- if cli
15- . run
16- . import_params
17- . pruning_params
18- . blocks_pruning
19- . is_some ( )
20- || cli. run . import_params . pruning_params . state_pruning != Some ( "archive" . into ( ) )
21- {
22- warn ! ( "Pruning not supported. Switching to keeping all block bodies and states." ) ;
23- cli. run . import_params . pruning_params . blocks_pruning = None ;
24- cli. run . import_params . pruning_params . state_pruning = Some ( "archive" . into ( ) ) ;
13+ if !cli. aleph . experimental_pruning ( ) {
14+ if cli
15+ . run
16+ . import_params
17+ . pruning_params
18+ . blocks_pruning
19+ . is_some ( )
20+ || cli. run . import_params . pruning_params . state_pruning != Some ( "archive" . into ( ) )
21+ {
22+ warn ! ( "Pruning not supported. Switching to keeping all block bodies and states." ) ;
23+ cli. run . import_params . pruning_params . blocks_pruning = None ;
24+ cli. run . import_params . pruning_params . state_pruning = Some ( "archive" . into ( ) ) ;
25+ }
26+ } else {
27+ warn ! ( "Pruning not supported, but flag experimental_pruning was turned on. Usage of this flag can lead to misbehaviour, which can be punished." ) ;
2528 }
2629
2730 match & cli. subcommand {
You can’t perform that action at this time.
0 commit comments