@@ -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
@@ -359,17 +357,14 @@ pub(crate) fn setup_node(
359357pub ( crate ) fn generate_blocks_and_wait < E : ElectrumApi > (
360358 bitcoind : & BitcoindClient , electrs : & E , num : usize ,
361359) {
362- let _ = bitcoind. create_wallet ( "ldk_node_test" , None , None , None , None ) ;
360+ let _ = bitcoind. create_wallet ( "ldk_node_test" ) ;
363361 let _ = bitcoind. load_wallet ( "ldk_node_test" ) ;
364362 print ! ( "Generating {} blocks..." , num) ;
365- let cur_height = bitcoind. get_block_count ( ) . expect ( "failed to get current block height" ) ;
366- let address = bitcoind
367- . get_new_address ( Some ( "test" ) , Some ( AddressType :: Legacy ) )
368- . expect ( "failed to get new address" )
369- . require_network ( bitcoin:: Network :: Regtest )
370- . expect ( "failed to get new address" ) ;
363+ let blockchain_info = bitcoind. get_blockchain_info ( ) . expect ( "failed to get blockchain info" ) ;
364+ let cur_height = blockchain_info. blocks ;
365+ let address = bitcoind. new_address ( ) . expect ( "failed to get new address" ) ;
371366 // TODO: expect this Result once the WouldBlock issue is resolved upstream.
372- let _block_hashes_res = bitcoind. generate_to_address ( num as u64 , & address) ;
367+ let _block_hashes_res = bitcoind. generate_to_address ( num, & address) ;
373368 wait_for_block ( electrs, cur_height as usize + num) ;
374369 print ! ( " Done!" ) ;
375370 println ! ( "\n " ) ;
@@ -450,13 +445,12 @@ where
450445pub ( crate ) fn premine_and_distribute_funds < E : ElectrumApi > (
451446 bitcoind : & BitcoindClient , electrs : & E , addrs : Vec < Address > , amount : Amount ,
452447) {
453- let _ = bitcoind. create_wallet ( "ldk_node_test" , None , None , None , None ) ;
448+ let _ = bitcoind. create_wallet ( "ldk_node_test" ) ;
454449 let _ = bitcoind. load_wallet ( "ldk_node_test" ) ;
455450 generate_blocks_and_wait ( bitcoind, electrs, 101 ) ;
456451
457452 for addr in addrs {
458- let txid =
459- bitcoind. send_to_address ( & addr, amount, None , None , None , None , None , None ) . unwrap ( ) ;
453+ let txid = bitcoind. send_to_address ( & addr, amount) . unwrap ( ) . 0 . parse ( ) . unwrap ( ) ;
460454 wait_for_tx ( electrs, txid) ;
461455 }
462456
0 commit comments