@@ -121,6 +121,7 @@ struct Args {
121
121
122
122
/// Listen address
123
123
listen : Option < ContextualNetAddress > ,
124
+ wait_time : Option < u64 > ,
124
125
add_peers : Vec < NetAddress > ,
125
126
// halt_mining_after_blocks: Option<u64>,
126
127
}
@@ -192,6 +193,9 @@ fn main_impl(mut args: Args) {
192
193
. apply_args ( |config| {
193
194
config. ram_scale = args. ram_scale ;
194
195
config. disable_upnp = true ;
196
+ if let Some ( listen_address) = args. listen {
197
+ config. p2p_listen_address = listen_address;
198
+ }
195
199
} )
196
200
. skip_proof_of_work ( )
197
201
. enable_sanity_checks ( ) ;
@@ -250,6 +254,7 @@ fn main_impl(mut args: Args) {
250
254
args. rocksdb_stats_period_sec ,
251
255
args. rocksdb_files_limit ,
252
256
args. rocksdb_mem_budget ,
257
+ args. wait_time . unwrap_or ( 0 ) ,
253
258
)
254
259
. run ( until) ;
255
260
@@ -341,28 +346,6 @@ fn apply_args_to_consensus_params(args: &Args, params: &mut Params) {
341
346
params. mergeset_size_limit = 32 ;
342
347
params. pruning_depth = params. anticone_finalization_depth ( ) ;
343
348
info ! ( "Setting pruning depth to {}" , params. pruning_depth) ;
344
- //// x2
345
- // params.pruning_proof_m = 32;
346
- // params.legacy_difficulty_window_size = 128;
347
- // params.legacy_timestamp_deviation_tolerance = 16;
348
- // params.new_timestamp_deviation_tolerance = 16;
349
- // // params.sampled_difficulty_window_size = params.sampled_difficulty_window_size.min(32);
350
- // params.finality_depth = 256;
351
- // params.merge_depth = 256;
352
- // params.mergeset_size_limit = 64;
353
- // params.pruning_depth = params.anticone_finalization_depth();
354
- // info!("Setting pruning depth to {}", params.pruning_depth);
355
- //// x4
356
- // params.pruning_proof_m = 64;
357
- // params.legacy_difficulty_window_size = 256;
358
- // params.legacy_timestamp_deviation_tolerance = 16;
359
- // params.new_timestamp_deviation_tolerance = 16;
360
- // // params.sampled_difficulty_window_size = params.sampled_difficulty_window_size.min(32);
361
- // params.finality_depth = 512;
362
- // params.merge_depth = 512;
363
- // params.mergeset_size_limit = 128;
364
- // params.pruning_depth = params.anticone_finalization_depth();
365
- // info!("Setting pruning depth to {}", params.pruning_depth);
366
349
}
367
350
}
368
351
@@ -498,7 +481,7 @@ mod tests {
498
481
let task1 = std:: thread:: spawn ( || {
499
482
let mut args = Args :: parse_from ( std:: iter:: empty :: < & str > ( ) ) ;
500
483
args. bps = 1.0 ;
501
- args. target_blocks = Some ( 4500 ) ;
484
+ args. target_blocks = Some ( 4120 ) ;
502
485
args. tpb = 1 ;
503
486
args. test_pruning = true ;
504
487
args. listen = Some ( ContextualNetAddress :: from_str ( "0.0.0.0:1234" ) . unwrap ( ) ) ;
@@ -518,7 +501,7 @@ mod tests {
518
501
let mut args = Args :: parse_from ( std:: iter:: empty :: < & str > ( ) ) ;
519
502
args. bps = 1.0 ;
520
503
// Run the simulation long enough to go through some more pruning periods
521
- args. sim_time = 30 ;
504
+ args. sim_time = 60 ;
522
505
args. tpb = 1 ;
523
506
args. test_pruning = true ;
524
507
args. listen = Some ( ContextualNetAddress :: from_str ( "0.0.0.0:5678" ) . unwrap ( ) ) ;
@@ -529,7 +512,28 @@ mod tests {
529
512
main_impl ( args) ;
530
513
} ) ;
531
514
515
+ // FIXME: This third task currently joins the network and IBDs, but for some reason
516
+ // only generates the one block. Maybe the first block's parents aren't properly set or something
517
+ // idk yet.
518
+ let task3 = std:: thread:: spawn ( || {
519
+ sleep ( Duration :: from_secs ( 50 ) ) ;
520
+ let mut args = Args :: parse_from ( std:: iter:: empty :: < & str > ( ) ) ;
521
+ args. bps = 1.0 ;
522
+ args. target_blocks = Some ( 3000 ) ;
523
+ args. tpb = 1 ;
524
+ args. test_pruning = true ;
525
+ args. listen = Some ( ContextualNetAddress :: from_str ( "0.0.0.0:9876" ) . unwrap ( ) ) ;
526
+ args. ram_scale = 4.0 ;
527
+ args. add_peers = vec ! [ ContextualNetAddress :: from_str( "127.0.0.1:5678" ) . unwrap( ) . normalize( 5678 ) ] ;
528
+ args. wait_time = Some ( 15 ) ;
529
+
530
+ kaspa_core:: log:: try_init_logger ( & args. log_level ) ;
531
+
532
+ main_impl ( args) ;
533
+ } ) ;
534
+
532
535
let _ = task1. join ( ) . expect ( "Task1 failed" ) ;
533
536
let _ = task2. join ( ) . expect ( "Task2 failed" ) ;
537
+ let _ = task3. join ( ) . expect ( "Task3 failed" ) ;
534
538
}
535
539
}
0 commit comments