@@ -7,7 +7,7 @@ use std::{path::PathBuf, sync::Arc};
7
7
use mithril_common:: {
8
8
chain_observer:: ChainObserver ,
9
9
crypto_helper:: tests_setup,
10
- entities:: PartyId ,
10
+ entities:: { BlockNumber , PartyId } ,
11
11
era:: {
12
12
adapters:: { EraReaderAdapterBuilder , EraReaderAdapterType } ,
13
13
EraReaderAdapter ,
@@ -27,14 +27,18 @@ pub struct Configuration {
27
27
#[ example = "`/tmp/cardano.sock`" ]
28
28
pub cardano_node_socket_path : PathBuf ,
29
29
30
+ /// Cardano network
31
+ #[ example = "`testnet` or `mainnet` or `devnet`" ]
32
+ pub network : String ,
33
+
30
34
/// Cardano Network Magic number
31
35
/// useful for TestNet & DevNet
32
36
#[ example = "`1097911063` or `42`" ]
33
37
pub network_magic : Option < u64 > ,
34
38
35
- /// Cardano network
36
- # [ example = "`testnet` or `mainnet` or `devnet`" ]
37
- pub network : String ,
39
+ /// Also known as `k`, it defines the number of blocks that are required for the blockchain to
40
+ /// be considered final, preventing any further rollback `[default: 2160]`.
41
+ pub network_security_parameter : BlockNumber ,
38
42
39
43
/// Aggregator endpoint
40
44
#[ example = "`https://aggregator.pre-release-preview.api.mithril.network/aggregator`" ]
@@ -95,6 +99,11 @@ pub struct Configuration {
95
99
///
96
100
/// Will be ignored on (pre)production networks.
97
101
pub allow_unparsable_block : bool ,
102
+
103
+ /// If set, the signer will prune the cardano transactions in database older than the
104
+ /// [network_security_parameter][Self::network_security_parameter] blocks after each import
105
+ /// `[default: true]`.
106
+ pub enable_transaction_pruning : bool ,
98
107
}
99
108
100
109
impl Configuration {
@@ -111,6 +120,7 @@ impl Configuration {
111
120
db_directory : PathBuf :: new ( ) ,
112
121
network : "devnet" . to_string ( ) ,
113
122
network_magic : Some ( 42 ) ,
123
+ network_security_parameter : 2160 ,
114
124
party_id : Some ( party_id) ,
115
125
run_interval : 5000 ,
116
126
data_stores_directory : PathBuf :: new ( ) ,
@@ -127,6 +137,7 @@ impl Configuration {
127
137
metrics_server_ip : "0.0.0.0" . to_string ( ) ,
128
138
metrics_server_port : 9090 ,
129
139
allow_unparsable_block : false ,
140
+ enable_transaction_pruning : false ,
130
141
}
131
142
}
132
143
@@ -187,6 +198,12 @@ pub struct DefaultConfiguration {
187
198
188
199
/// Metrics HTTP server listening port.
189
200
pub metrics_server_port : u16 ,
201
+
202
+ /// Network security parameter
203
+ pub network_security_parameter : BlockNumber ,
204
+
205
+ /// Transaction pruning toggle
206
+ pub enable_transaction_pruning : bool ,
190
207
}
191
208
192
209
impl DefaultConfiguration {
@@ -201,6 +218,8 @@ impl Default for DefaultConfiguration {
201
218
era_reader_adapter_type : "bootstrap" . to_string ( ) ,
202
219
metrics_server_ip : "0.0.0.0" . to_string ( ) ,
203
220
metrics_server_port : 9090 ,
221
+ network_security_parameter : 2160 , // 2160 is the mainnet value
222
+ enable_transaction_pruning : true ,
204
223
}
205
224
}
206
225
}
@@ -232,6 +251,16 @@ impl Source for DefaultConfiguration {
232
251
into_value ( myself. metrics_server_port ) ,
233
252
) ;
234
253
254
+ result. insert (
255
+ "network_security_parameter" . to_string ( ) ,
256
+ into_value ( myself. network_security_parameter ) ,
257
+ ) ;
258
+
259
+ result. insert (
260
+ "enable_transaction_pruning" . to_string ( ) ,
261
+ into_value ( myself. enable_transaction_pruning ) ,
262
+ ) ;
263
+
235
264
Ok ( result)
236
265
}
237
266
}
0 commit comments