@@ -33,11 +33,9 @@ use bitcoin::hashes::sha256::Hash as Sha256;
3333use bitcoin:: hashes:: Hash ;
3434use bitcoin:: { Address , Amount , Network , OutPoint , Txid } ;
3535
36- use bitcoincore_rpc:: bitcoincore_rpc_json:: AddressType ;
37- use bitcoincore_rpc:: Client as BitcoindClient ;
38- use bitcoincore_rpc:: RpcApi ;
39-
40- use electrsd:: { bitcoind, bitcoind:: BitcoinD , ElectrsD } ;
36+ use electrsd:: corepc_node:: Client as BitcoindClient ;
37+ use electrsd:: corepc_node:: Node as BitcoinD ;
38+ use electrsd:: { corepc_node, ElectrsD } ;
4139use electrum_client:: ElectrumApi ;
4240
4341use rand:: distributions:: Alphanumeric ;
@@ -171,10 +169,10 @@ pub(crate) use expect_payment_successful_event;
171169
172170pub ( crate ) fn setup_bitcoind_and_electrsd ( ) -> ( BitcoinD , ElectrsD ) {
173171 let bitcoind_exe =
174- env:: var ( "BITCOIND_EXE" ) . ok ( ) . or_else ( || bitcoind :: downloaded_exe_path ( ) . ok ( ) ) . expect (
172+ env:: var ( "BITCOIND_EXE" ) . ok ( ) . or_else ( || corepc_node :: downloaded_exe_path ( ) . ok ( ) ) . expect (
175173 "you need to provide an env var BITCOIND_EXE or specify a bitcoind version feature" ,
176174 ) ;
177- let mut bitcoind_conf = bitcoind :: Conf :: default ( ) ;
175+ let mut bitcoind_conf = corepc_node :: Conf :: default ( ) ;
178176 bitcoind_conf. network = "regtest" ;
179177 let bitcoind = BitcoinD :: with_conf ( bitcoind_exe, & bitcoind_conf) . unwrap ( ) ;
180178
@@ -361,17 +359,14 @@ pub(crate) fn setup_node(
361359pub ( crate ) fn generate_blocks_and_wait < E : ElectrumApi > (
362360 bitcoind : & BitcoindClient , electrs : & E , num : usize ,
363361) {
364- let _ = bitcoind. create_wallet ( "ldk_node_test" , None , None , None , None ) ;
362+ let _ = bitcoind. create_wallet ( "ldk_node_test" ) ;
365363 let _ = bitcoind. load_wallet ( "ldk_node_test" ) ;
366364 print ! ( "Generating {} blocks..." , num) ;
367- let cur_height = bitcoind. get_block_count ( ) . expect ( "failed to get current block height" ) ;
368- let address = bitcoind
369- . get_new_address ( Some ( "test" ) , Some ( AddressType :: Legacy ) )
370- . expect ( "failed to get new address" )
371- . require_network ( bitcoin:: Network :: Regtest )
372- . expect ( "failed to get new address" ) ;
365+ let blockchain_info = bitcoind. get_blockchain_info ( ) . expect ( "failed to get blockchain info" ) ;
366+ let cur_height = blockchain_info. blocks ;
367+ let address = bitcoind. new_address ( ) . expect ( "failed to get new address" ) ;
373368 // TODO: expect this Result once the WouldBlock issue is resolved upstream.
374- let _block_hashes_res = bitcoind. generate_to_address ( num as u64 , & address) ;
369+ let _block_hashes_res = bitcoind. generate_to_address ( num, & address) ;
375370 wait_for_block ( electrs, cur_height as usize + num) ;
376371 print ! ( " Done!" ) ;
377372 println ! ( "\n " ) ;
@@ -452,13 +447,12 @@ where
452447pub ( crate ) fn premine_and_distribute_funds < E : ElectrumApi > (
453448 bitcoind : & BitcoindClient , electrs : & E , addrs : Vec < Address > , amount : Amount ,
454449) {
455- let _ = bitcoind. create_wallet ( "ldk_node_test" , None , None , None , None ) ;
450+ let _ = bitcoind. create_wallet ( "ldk_node_test" ) ;
456451 let _ = bitcoind. load_wallet ( "ldk_node_test" ) ;
457452 generate_blocks_and_wait ( bitcoind, electrs, 101 ) ;
458453
459454 for addr in addrs {
460- let txid =
461- bitcoind. send_to_address ( & addr, amount, None , None , None , None , None , None ) . unwrap ( ) ;
455+ let txid = bitcoind. send_to_address ( & addr, amount) . unwrap ( ) . 0 . parse ( ) . unwrap ( ) ;
462456 wait_for_tx ( electrs, txid) ;
463457 }
464458
0 commit comments