@@ -150,6 +150,7 @@ impl BitcoinD {
150
150
Err ( _) => TempDir :: new ( ) ,
151
151
} ,
152
152
} ?;
153
+ debug ! ( "work_dir: {:?}" , work_dir) ;
153
154
let datadir = work_dir. path ( ) . to_path_buf ( ) ;
154
155
let cookie_file = datadir. join ( conf. network ) . join ( ".cookie" ) ;
155
156
let rpc_port = get_available_port ( ) ?;
@@ -329,15 +330,6 @@ mod test {
329
330
assert_eq ! ( format!( "127.0.0.1:{}" , port) , format!( "{}" , socket) ) ;
330
331
}
331
332
332
- #[ test]
333
- fn test_default ( ) {
334
- let conf = Conf {
335
- p2p : P2P :: Yes ,
336
- ..Default :: default ( )
337
- } ;
338
- assert_eq ! ( "regtest" , conf. network) ;
339
- }
340
-
341
333
#[ test]
342
334
fn test_bitcoind ( ) {
343
335
let exe = init ( ) ;
@@ -371,41 +363,33 @@ mod test {
371
363
#[ test]
372
364
fn test_p2p ( ) {
373
365
let exe = init ( ) ;
374
- let conf = Conf {
375
- p2p : P2P :: Yes ,
376
- ..Default :: default ( )
377
- } ;
366
+ let mut conf = Conf :: default ( ) ;
367
+ conf. p2p = P2P :: Yes ;
368
+
378
369
let bitcoind = BitcoinD :: with_conf ( & exe, & conf) . unwrap ( ) ;
379
370
assert_eq ! ( bitcoind. client. get_peer_info( ) . unwrap( ) . len( ) , 0 ) ;
380
- let other_conf = Conf {
381
- p2p : bitcoind. p2p_connect ( false ) . unwrap ( ) ,
382
- ..Default :: default ( )
383
- } ;
371
+ let mut other_conf = Conf :: default ( ) ;
372
+ other_conf. p2p = bitcoind. p2p_connect ( false ) . unwrap ( ) ;
373
+
384
374
let other_bitcoind = BitcoinD :: with_conf ( & exe, & other_conf) . unwrap ( ) ;
385
375
assert_eq ! ( bitcoind. client. get_peer_info( ) . unwrap( ) . len( ) , 1 ) ;
386
376
assert_eq ! ( other_bitcoind. client. get_peer_info( ) . unwrap( ) . len( ) , 1 ) ;
387
377
}
388
378
389
379
#[ test]
390
380
fn test_multi_p2p ( ) {
391
- let conf_node1 = Conf {
392
- p2p : P2P :: Yes ,
393
- ..Default :: default ( )
394
- } ;
381
+ let mut conf_node1 = Conf :: default ( ) ;
382
+ conf_node1. p2p = P2P :: Yes ;
395
383
let node1 = BitcoinD :: with_conf ( exe_path ( ) , & conf_node1) . unwrap ( ) ;
396
384
397
385
// Create Node 2 connected Node 1
398
- let conf_node2 = Conf {
399
- p2p : node1. p2p_connect ( true ) . unwrap ( ) ,
400
- ..Default :: default ( )
401
- } ;
386
+ let mut conf_node2 = Conf :: default ( ) ;
387
+ conf_node2. p2p = node1. p2p_connect ( true ) . unwrap ( ) ;
402
388
let node2 = BitcoinD :: with_conf ( exe_path ( ) , & conf_node2) . unwrap ( ) ;
403
389
404
- // Create Node 3 Connected To Node 2
405
- let conf_node3 = Conf {
406
- p2p : node2. p2p_connect ( false ) . unwrap ( ) ,
407
- ..Default :: default ( )
408
- } ;
390
+ // Create Node 3 Connected To Node
391
+ let mut conf_node3 = Conf :: default ( ) ;
392
+ conf_node3. p2p = node2. p2p_connect ( false ) . unwrap ( ) ;
409
393
let node3 = BitcoinD :: with_conf ( exe_path ( ) , & conf_node3) . unwrap ( ) ;
410
394
411
395
// Get each nodes Peers
0 commit comments