@@ -21,7 +21,7 @@ use common::{
2121 expect_channel_pending_event, expect_channel_ready_event, expect_event,
2222 expect_payment_claimable_event, expect_payment_received_event, expect_payment_successful_event,
2323 expect_splice_pending_event, generate_blocks_and_wait, open_channel, open_channel_push_amt,
24- premine_and_distribute_funds, premine_blocks, prepare_rbf, random_config,
24+ premine_and_distribute_funds, premine_blocks, prepare_rbf, random_chain_source , random_config,
2525 random_listening_addresses, setup_bitcoind_and_electrsd, setup_builder, setup_node,
2626 setup_two_nodes, wait_for_tx, TestChainSource , TestStoreType , TestSyncStore ,
2727} ;
@@ -43,34 +43,7 @@ use log::LevelFilter;
4343#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
4444async fn channel_full_cycle ( ) {
4545 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
46- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
47- let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , true , false ) ;
48- do_channel_full_cycle ( node_a, node_b, & bitcoind. client , & electrsd. client , false , true , false )
49- . await ;
50- }
51-
52- #[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
53- async fn channel_full_cycle_electrum ( ) {
54- let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
55- let chain_source = TestChainSource :: Electrum ( & electrsd) ;
56- let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , true , false ) ;
57- do_channel_full_cycle ( node_a, node_b, & bitcoind. client , & electrsd. client , false , true , false )
58- . await ;
59- }
60-
61- #[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
62- async fn channel_full_cycle_bitcoind_rpc_sync ( ) {
63- let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
64- let chain_source = TestChainSource :: BitcoindRpcSync ( & bitcoind) ;
65- let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , true , false ) ;
66- do_channel_full_cycle ( node_a, node_b, & bitcoind. client , & electrsd. client , false , true , false )
67- . await ;
68- }
69-
70- #[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
71- async fn channel_full_cycle_bitcoind_rest_sync ( ) {
72- let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
73- let chain_source = TestChainSource :: BitcoindRestSync ( & bitcoind) ;
46+ let chain_source = random_chain_source ( & bitcoind, & electrsd) ;
7447 let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , true , false ) ;
7548 do_channel_full_cycle ( node_a, node_b, & bitcoind. client , & electrsd. client , false , true , false )
7649 . await ;
@@ -79,7 +52,7 @@ async fn channel_full_cycle_bitcoind_rest_sync() {
7952#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
8053async fn channel_full_cycle_force_close ( ) {
8154 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
82- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
55+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
8356 let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , true , false ) ;
8457 do_channel_full_cycle ( node_a, node_b, & bitcoind. client , & electrsd. client , false , true , true )
8558 . await ;
@@ -88,7 +61,7 @@ async fn channel_full_cycle_force_close() {
8861#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
8962async fn channel_full_cycle_force_close_trusted_no_reserve ( ) {
9063 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
91- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
64+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
9265 let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , true , true ) ;
9366 do_channel_full_cycle ( node_a, node_b, & bitcoind. client , & electrsd. client , false , true , true )
9467 . await ;
@@ -97,7 +70,7 @@ async fn channel_full_cycle_force_close_trusted_no_reserve() {
9770#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
9871async fn channel_full_cycle_0conf ( ) {
9972 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
100- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
73+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
10174 let ( node_a, node_b) = setup_two_nodes ( & chain_source, true , true , false ) ;
10275 do_channel_full_cycle ( node_a, node_b, & bitcoind. client , & electrsd. client , true , true , false )
10376 . await ;
@@ -106,7 +79,7 @@ async fn channel_full_cycle_0conf() {
10679#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
10780async fn channel_full_cycle_legacy_staticremotekey ( ) {
10881 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
109- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
82+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
11083 let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , false , false ) ;
11184 do_channel_full_cycle ( node_a, node_b, & bitcoind. client , & electrsd. client , false , false , false )
11285 . await ;
@@ -115,7 +88,7 @@ async fn channel_full_cycle_legacy_staticremotekey() {
11588#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
11689async fn channel_open_fails_when_funds_insufficient ( ) {
11790 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
118- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
91+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
11992 let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , true , false ) ;
12093
12194 let addr_a = node_a. onchain_payment ( ) . new_address ( ) . unwrap ( ) ;
@@ -322,7 +295,7 @@ async fn start_stop_reinit() {
322295#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
323296async fn onchain_send_receive ( ) {
324297 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
325- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
298+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
326299 let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , true , false ) ;
327300
328301 let addr_a = node_a. onchain_payment ( ) . new_address ( ) . unwrap ( ) ;
@@ -523,7 +496,7 @@ async fn onchain_send_receive() {
523496#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
524497async fn onchain_send_all_retains_reserve ( ) {
525498 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
526- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
499+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
527500 let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , true , false ) ;
528501
529502 // Setup nodes
@@ -608,7 +581,7 @@ async fn onchain_send_all_retains_reserve() {
608581async fn onchain_wallet_recovery ( ) {
609582 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
610583
611- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
584+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
612585
613586 let original_config = random_config ( true ) ;
614587 let original_node_entropy = original_config. node_entropy ;
@@ -823,9 +796,9 @@ async fn run_rbf_test(is_insert_block: bool) {
823796
824797#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
825798async fn sign_verify_msg ( ) {
826- let ( _bitcoind , electrsd) = setup_bitcoind_and_electrsd ( ) ;
799+ let ( bitcoind , electrsd) = setup_bitcoind_and_electrsd ( ) ;
827800 let config = random_config ( true ) ;
828- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
801+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
829802 let node = setup_node ( & chain_source, config) ;
830803
831804 // Tests arbitrary message signing and later verification
@@ -837,8 +810,8 @@ async fn sign_verify_msg() {
837810
838811#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
839812async fn connection_multi_listen ( ) {
840- let ( _bitcoind , electrsd) = setup_bitcoind_and_electrsd ( ) ;
841- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
813+ let ( bitcoind , electrsd) = setup_bitcoind_and_electrsd ( ) ;
814+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
842815 let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , false , false ) ;
843816
844817 let node_id_b = node_b. node_id ( ) ;
@@ -857,8 +830,8 @@ async fn connection_restart_behavior() {
857830}
858831
859832async fn do_connection_restart_behavior ( persist : bool ) {
860- let ( _bitcoind , electrsd) = setup_bitcoind_and_electrsd ( ) ;
861- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
833+ let ( bitcoind , electrsd) = setup_bitcoind_and_electrsd ( ) ;
834+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
862835 let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , false , false ) ;
863836
864837 let node_id_a = node_a. node_id ( ) ;
@@ -904,8 +877,8 @@ async fn do_connection_restart_behavior(persist: bool) {
904877
905878#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
906879async fn concurrent_connections_succeed ( ) {
907- let ( _bitcoind , electrsd) = setup_bitcoind_and_electrsd ( ) ;
908- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
880+ let ( bitcoind , electrsd) = setup_bitcoind_and_electrsd ( ) ;
881+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
909882 let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , true , false ) ;
910883
911884 let node_a = Arc :: new ( node_a) ;
@@ -929,13 +902,11 @@ async fn concurrent_connections_succeed() {
929902 }
930903}
931904
932- async fn run_splice_channel_test ( bitcoind_chain_source : bool ) {
905+ #[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
906+ async fn splice_channel ( ) {
933907 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
934- let chain_source = if bitcoind_chain_source {
935- TestChainSource :: BitcoindRpcSync ( & bitcoind)
936- } else {
937- TestChainSource :: Esplora ( & electrsd)
938- } ;
908+ let chain_source = random_chain_source ( & bitcoind, & electrsd) ;
909+
939910 let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , true , false ) ;
940911
941912 let address_a = node_a. onchain_payment ( ) . new_address ( ) . unwrap ( ) ;
@@ -1071,16 +1042,10 @@ async fn run_splice_channel_test(bitcoind_chain_source: bool) {
10711042 ) ;
10721043}
10731044
1074- #[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
1075- async fn splice_channel ( ) {
1076- run_splice_channel_test ( false ) . await ;
1077- run_splice_channel_test ( true ) . await ;
1078- }
1079-
10801045#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
10811046async fn simple_bolt12_send_receive ( ) {
10821047 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
1083- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
1048+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
10841049 let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , true , false ) ;
10851050
10861051 let address_a = node_a. onchain_payment ( ) . new_address ( ) . unwrap ( ) ;
@@ -1309,7 +1274,7 @@ async fn simple_bolt12_send_receive() {
13091274#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
13101275async fn async_payment ( ) {
13111276 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
1312- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
1277+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
13131278
13141279 let mut config_sender = random_config ( true ) ;
13151280 config_sender. node_config . listening_addresses = None ;
@@ -1435,7 +1400,7 @@ async fn async_payment() {
14351400#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
14361401async fn test_node_announcement_propagation ( ) {
14371402 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
1438- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
1403+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
14391404
14401405 // Node A will use both listening and announcement addresses
14411406 let mut config_a = random_config ( true ) ;
@@ -1527,7 +1492,7 @@ async fn test_node_announcement_propagation() {
15271492#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
15281493async fn generate_bip21_uri ( ) {
15291494 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
1530- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
1495+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
15311496
15321497 let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , true , false ) ;
15331498
@@ -1582,7 +1547,7 @@ async fn generate_bip21_uri() {
15821547#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
15831548async fn unified_send_receive_bip21_uri ( ) {
15841549 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
1585- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
1550+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
15861551
15871552 let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , true , false ) ;
15881553
@@ -1921,8 +1886,8 @@ async fn do_lsps2_client_service_integration(client_trusts_lsp: bool) {
19211886
19221887#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
19231888async fn facade_logging ( ) {
1924- let ( _bitcoind , electrsd) = setup_bitcoind_and_electrsd ( ) ;
1925- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
1889+ let ( bitcoind , electrsd) = setup_bitcoind_and_electrsd ( ) ;
1890+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
19261891
19271892 let logger = init_log_logger ( LevelFilter :: Trace ) ;
19281893 let mut config = random_config ( false ) ;
@@ -1940,7 +1905,7 @@ async fn facade_logging() {
19401905#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
19411906async fn spontaneous_send_with_custom_preimage ( ) {
19421907 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
1943- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
1908+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
19441909 let ( node_a, node_b) = setup_two_nodes ( & chain_source, false , true , false ) ;
19451910
19461911 let address_a = node_a. onchain_payment ( ) . new_address ( ) . unwrap ( ) ;
@@ -2006,8 +1971,8 @@ async fn spontaneous_send_with_custom_preimage() {
20061971
20071972#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
20081973async fn drop_in_async_context ( ) {
2009- let ( _bitcoind , electrsd) = setup_bitcoind_and_electrsd ( ) ;
2010- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
1974+ let ( bitcoind , electrsd) = setup_bitcoind_and_electrsd ( ) ;
1975+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
20111976 let config = random_config ( true ) ;
20121977 let node = setup_node ( & chain_source, config) ;
20131978 node. stop ( ) . unwrap ( ) ;
@@ -2318,7 +2283,7 @@ async fn lsps2_lsp_trusts_client_but_client_does_not_claim() {
23182283#[ tokio:: test( flavor = "multi_thread" , worker_threads = 1 ) ]
23192284async fn payment_persistence_after_restart ( ) {
23202285 let ( bitcoind, electrsd) = setup_bitcoind_and_electrsd ( ) ;
2321- let chain_source = TestChainSource :: Esplora ( & electrsd) ;
2286+ let chain_source = random_chain_source ( & bitcoind , & electrsd) ;
23222287
23232288 // Setup nodes manually so we can restart node_a with the same config
23242289 println ! ( "== Node A ==" ) ;
0 commit comments