@@ -104,6 +104,7 @@ fn to_toml_array(vec: Vec<&str>) -> Value {
104
104
105
105
fn to_toml (
106
106
i : usize ,
107
+ open_ports : bool ,
107
108
config_type : & ConfigType ,
108
109
external_ip : Option < & str > ,
109
110
signer_address : & Address ,
@@ -116,6 +117,7 @@ fn to_toml(
116
117
base_ws_port : u16 ,
117
118
) -> Value {
118
119
let mut parity = Map :: new ( ) ;
120
+
119
121
match config_type {
120
122
ConfigType :: PosdaoSetup => {
121
123
parity. insert ( "chain" . into ( ) , Value :: String ( "./spec/spec.json" . into ( ) ) ) ;
@@ -169,33 +171,37 @@ fn to_toml(
169
171
}
170
172
171
173
let mut rpc = Map :: new ( ) ;
172
- rpc. insert ( "interface" . into ( ) , Value :: String ( "all" . into ( ) ) ) ;
173
- rpc. insert ( "cors" . into ( ) , to_toml_array ( vec ! [ "all" ] ) ) ;
174
- rpc. insert ( "hosts" . into ( ) , to_toml_array ( vec ! [ "all" ] ) ) ;
175
- let apis = to_toml_array ( vec ! [
176
- "web3" ,
177
- "eth" ,
178
- "pubsub" ,
179
- "net" ,
180
- "parity" ,
181
- "parity_set" ,
182
- "parity_pubsub" ,
183
- "personal" ,
184
- "traces" ,
185
- ] ) ;
186
- rpc. insert ( "apis" . into ( ) , apis) ;
187
- rpc. insert (
188
- "port" . into ( ) ,
189
- Value :: Integer ( ( base_rpc_port as usize + i) as i64 ) ,
190
- ) ;
191
-
192
174
let mut websockets = Map :: new ( ) ;
193
- websockets. insert ( "interface" . into ( ) , Value :: String ( "all" . into ( ) ) ) ;
194
- websockets. insert ( "origins" . into ( ) , to_toml_array ( vec ! [ "all" ] ) ) ;
195
- websockets. insert (
196
- "port" . into ( ) ,
197
- Value :: Integer ( ( base_ws_port as usize + i) as i64 ) ,
198
- ) ;
175
+
176
+ if open_ports {
177
+ rpc. insert ( "interface" . into ( ) , Value :: String ( "all" . into ( ) ) ) ;
178
+ rpc. insert ( "cors" . into ( ) , to_toml_array ( vec ! [ "all" ] ) ) ;
179
+ rpc. insert ( "hosts" . into ( ) , to_toml_array ( vec ! [ "all" ] ) ) ;
180
+ let apis = to_toml_array ( vec ! [
181
+ "web3" ,
182
+ "eth" ,
183
+ "pubsub" ,
184
+ "net" ,
185
+ "parity" ,
186
+ "parity_pubsub" ,
187
+ "traces" ,
188
+ ] ) ;
189
+ rpc. insert ( "apis" . into ( ) , apis) ;
190
+ rpc. insert (
191
+ "port" . into ( ) ,
192
+ Value :: Integer ( ( base_rpc_port as usize + i) as i64 ) ,
193
+ ) ;
194
+
195
+ websockets. insert ( "interface" . into ( ) , Value :: String ( "all" . into ( ) ) ) ;
196
+ websockets. insert ( "origins" . into ( ) , to_toml_array ( vec ! [ "all" ] ) ) ;
197
+ websockets. insert (
198
+ "port" . into ( ) ,
199
+ Value :: Integer ( ( base_ws_port as usize + i) as i64 ) ,
200
+ ) ;
201
+ } else {
202
+ rpc. insert ( "disable" . into ( ) , Value :: Boolean ( true ) ) ;
203
+ websockets. insert ( "disable" . into ( ) , Value :: Boolean ( true ) ) ;
204
+ }
199
205
200
206
let mut ipc = Map :: new ( ) ;
201
207
ipc. insert ( "disable" . into ( ) , Value :: Boolean ( true ) ) ;
@@ -231,11 +237,10 @@ fn to_toml(
231
237
}
232
238
233
239
mining. insert ( "force_sealing" . into ( ) , Value :: Boolean ( true ) ) ;
234
- mining. insert ( "min_gas_price" . into ( ) , Value :: Integer ( 1000000000 ) ) ;
235
- mining. insert (
236
- "gas_floor_target" . into ( ) ,
237
- Value :: String ( "1000000000" . into ( ) ) ,
238
- ) ;
240
+ // we put an extremly low min gas price in the config
241
+ // the min gas price is gathered from the DAO
242
+ // this makes sure that the min_gas_price wont be higher then the gas pricce the DAO decides.
243
+ mining. insert ( "min_gas_price" . into ( ) , Value :: Integer ( 1000 ) ) ;
239
244
mining. insert ( "reseal_on_txs" . into ( ) , Value :: String ( "none" . into ( ) ) ) ;
240
245
mining. insert ( "reseal_min_period" . into ( ) , Value :: Integer ( 0 ) ) ;
241
246
@@ -252,7 +257,7 @@ fn to_toml(
252
257
// Value::String("txqueue=trace,consensus=debug,engine=trace,own_tx=trace,miner=trace,tx_filter=trace".into())
253
258
misc. insert (
254
259
"logging" . into ( ) ,
255
- Value :: String ( "txqueue=info,consensus=debug,engine=trace ,tx_own=trace" . into ( ) ) ,
260
+ Value :: String ( "txqueue=info,consensus=debug,engine=debug ,tx_own=trace" . into ( ) ) ,
256
261
) ;
257
262
misc. insert ( "log_file" . into ( ) , Value :: String ( "diamond-node.log" . into ( ) ) ) ;
258
263
@@ -431,12 +436,12 @@ fn main() {
431
436
)
432
437
} ) ;
433
438
434
- let fork_block_number: Option < i64 > = matches. value_of ( "fork_block_number" ) . map_or ( None , |v| {
435
- Some (
436
- v. parse :: < i64 > ( )
437
- . expect ( "fork_block_number need to be of integer type" ) ,
438
- )
439
- } ) ;
439
+ // let fork_block_number: Option<i64> = matches.value_of("fork_block_number").map_or(None, |v| {
440
+ // Some(
441
+ // v.parse::<i64>()
442
+ // .expect("fork_block_number need to be of integer type"),
443
+ // )
444
+ // });
440
445
441
446
let metrics_port_base: Option < u16 > = matches. value_of ( "metrics_port_base" ) . map_or ( None , |v| {
442
447
Some (
@@ -525,6 +530,7 @@ fn main() {
525
530
// the unwrap is safe, because there is a default value defined.
526
531
let toml_string = toml:: to_string ( & to_toml (
527
532
i,
533
+ false ,
528
534
& config_type,
529
535
external_ip,
530
536
& enode. address ,
@@ -565,6 +571,7 @@ fn main() {
565
571
// Write rpc node config
566
572
let rpc_string = toml:: to_string ( & to_toml (
567
573
0 ,
574
+ true ,
568
575
& ConfigType :: Rpc ,
569
576
external_ip,
570
577
& Address :: default ( ) , // todo: insert HBBFT Contracts pot here.
0 commit comments