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 {
40
40
/// BEHAVIOUR AND PUNISHED ACCORDINGLY!
41
41
#[ clap( long, default_value_t = 20 ) ]
42
42
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 ,
43
49
}
44
50
45
51
impl AlephCli {
@@ -69,4 +75,8 @@ impl AlephCli {
69
75
}
70
76
self . max_nonfinalized_blocks
71
77
}
78
+
79
+ pub fn experimental_pruning ( & self ) -> bool {
80
+ self . experimental_pruning
81
+ }
72
82
}
Original file line number Diff line number Diff line change @@ -10,18 +10,21 @@ use sc_service::PartialComponents;
10
10
11
11
fn main ( ) -> sc_cli:: Result < ( ) > {
12
12
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." ) ;
25
28
}
26
29
27
30
match & cli. subcommand {
You can’t perform that action at this time.
0 commit comments