@@ -30,11 +30,9 @@ use bitcoin::hashes::sha256::Hash as Sha256;
3030use bitcoin:: hashes:: Hash ;
3131use bitcoin:: { Address , Amount , Network , OutPoint , Txid } ;
3232
33- use bitcoincore_rpc:: bitcoincore_rpc_json:: AddressType ;
34- use bitcoincore_rpc:: Client as BitcoindClient ;
35- use bitcoincore_rpc:: RpcApi ;
36-
37- use electrsd:: { bitcoind, bitcoind:: BitcoinD , ElectrsD } ;
33+ use electrsd:: corepc_node:: Client as BitcoindClient ;
34+ use electrsd:: corepc_node:: Node as BitcoinD ;
35+ use electrsd:: { corepc_node, ElectrsD } ;
3836use electrum_client:: ElectrumApi ;
3937
4038use rand:: distributions:: Alphanumeric ;
@@ -168,10 +166,10 @@ pub(crate) use expect_payment_successful_event;
168166
169167pub ( crate ) fn setup_bitcoind_and_electrsd ( ) -> ( BitcoinD , ElectrsD ) {
170168 let bitcoind_exe =
171- env:: var ( "BITCOIND_EXE" ) . ok ( ) . or_else ( || bitcoind :: downloaded_exe_path ( ) . ok ( ) ) . expect (
169+ env:: var ( "BITCOIND_EXE" ) . ok ( ) . or_else ( || corepc_node :: downloaded_exe_path ( ) . ok ( ) ) . expect (
172170 "you need to provide an env var BITCOIND_EXE or specify a bitcoind version feature" ,
173171 ) ;
174- let mut bitcoind_conf = bitcoind :: Conf :: default ( ) ;
172+ let mut bitcoind_conf = corepc_node :: Conf :: default ( ) ;
175173 bitcoind_conf. network = "regtest" ;
176174 let bitcoind = BitcoinD :: with_conf ( bitcoind_exe, & bitcoind_conf) . unwrap ( ) ;
177175
@@ -333,17 +331,14 @@ pub(crate) fn setup_node(
333331pub ( crate ) fn generate_blocks_and_wait < E : ElectrumApi > (
334332 bitcoind : & BitcoindClient , electrs : & E , num : usize ,
335333) {
336- let _ = bitcoind. create_wallet ( "ldk_node_test" , None , None , None , None ) ;
334+ let _ = bitcoind. create_wallet ( "ldk_node_test" ) ;
337335 let _ = bitcoind. load_wallet ( "ldk_node_test" ) ;
338336 print ! ( "Generating {} blocks..." , num) ;
339- let cur_height = bitcoind. get_block_count ( ) . expect ( "failed to get current block height" ) ;
340- let address = bitcoind
341- . get_new_address ( Some ( "test" ) , Some ( AddressType :: Legacy ) )
342- . expect ( "failed to get new address" )
343- . require_network ( bitcoin:: Network :: Regtest )
344- . expect ( "failed to get new address" ) ;
337+ let blockchain_info = bitcoind. get_blockchain_info ( ) . expect ( "failed to get blockchain info" ) ;
338+ let cur_height = blockchain_info. blocks ;
339+ let address = bitcoind. new_address ( ) . expect ( "failed to get new address" ) ;
345340 // TODO: expect this Result once the WouldBlock issue is resolved upstream.
346- let _block_hashes_res = bitcoind. generate_to_address ( num as u64 , & address) ;
341+ let _block_hashes_res = bitcoind. generate_to_address ( num, & address) ;
347342 wait_for_block ( electrs, cur_height as usize + num) ;
348343 print ! ( " Done!" ) ;
349344 println ! ( "\n " ) ;
@@ -424,13 +419,12 @@ where
424419pub ( crate ) fn premine_and_distribute_funds < E : ElectrumApi > (
425420 bitcoind : & BitcoindClient , electrs : & E , addrs : Vec < Address > , amount : Amount ,
426421) {
427- let _ = bitcoind. create_wallet ( "ldk_node_test" , None , None , None , None ) ;
422+ let _ = bitcoind. create_wallet ( "ldk_node_test" ) ;
428423 let _ = bitcoind. load_wallet ( "ldk_node_test" ) ;
429424 generate_blocks_and_wait ( bitcoind, electrs, 101 ) ;
430425
431426 for addr in addrs {
432- let txid =
433- bitcoind. send_to_address ( & addr, amount, None , None , None , None , None , None ) . unwrap ( ) ;
427+ let txid = bitcoind. send_to_address ( & addr, amount) . unwrap ( ) . 0 . parse ( ) . unwrap ( ) ;
434428 wait_for_tx ( electrs, txid) ;
435429 }
436430
0 commit comments