@@ -9,32 +9,32 @@ use bdk_chain::{
99 local_chain:: CheckPoint ,
1010 BlockId ,
1111} ;
12- use bitcoincore_rpc:: {
13- bitcoincore_rpc_json:: { GetBlockTemplateModes , GetBlockTemplateRules } ,
14- RpcApi ,
15- } ;
16- use electrsd:: bitcoind :: anyhow:: Context ;
12+ // use bitcoincore_rpc::{
13+ // bitcoincore_rpc_json::{GetBlockTemplateModes, GetBlockTemplateRules},
14+ // RpcApi,
15+ // };
16+ use electrsd:: corepc_node :: anyhow:: Context ;
1717
1818pub use electrsd;
19- pub use electrsd:: bitcoind ;
20- pub use electrsd:: bitcoind :: anyhow;
21- pub use electrsd:: bitcoind :: bitcoincore_rpc;
19+ pub use electrsd:: corepc_node ;
20+ pub use electrsd:: corepc_node :: anyhow;
21+ // pub use electrsd::corepc_node ::bitcoincore_rpc;
2222pub use electrsd:: electrum_client;
2323use electrsd:: electrum_client:: ElectrumApi ;
2424use std:: time:: Duration ;
2525
2626/// Struct for running a regtest environment with a single `bitcoind` node with an `electrs`
2727/// instance connected to it.
2828pub struct TestEnv {
29- pub bitcoind : electrsd :: bitcoind :: BitcoinD ,
29+ pub bitcoind : corepc_node :: Node ,
3030 pub electrsd : electrsd:: ElectrsD ,
3131}
3232
3333/// Configuration parameters.
3434#[ derive( Debug ) ]
3535pub struct Config < ' a > {
36- /// [`bitcoind ::Conf`]
37- pub bitcoind : bitcoind :: Conf < ' a > ,
36+ /// [`corepc_node ::Conf`]
37+ pub bitcoind : electrsd :: corepc_node :: Conf < ' a > ,
3838 /// [`electrsd::Conf`]
3939 pub electrsd : electrsd:: Conf < ' a > ,
4040}
@@ -44,7 +44,7 @@ impl Default for Config<'_> {
4444 /// which is required for testing `bdk_esplora`.
4545 fn default ( ) -> Self {
4646 Self {
47- bitcoind : bitcoind :: Conf :: default ( ) ,
47+ bitcoind : corepc_node :: Conf :: default ( ) ,
4848 electrsd : {
4949 let mut conf = electrsd:: Conf :: default ( ) ;
5050 conf. http_enabled = true ;
@@ -64,11 +64,11 @@ impl TestEnv {
6464 pub fn new_with_config ( config : Config ) -> anyhow:: Result < Self > {
6565 let bitcoind_exe = match std:: env:: var ( "BITCOIND_EXE" ) {
6666 Ok ( path) => path,
67- Err ( _) => bitcoind :: downloaded_exe_path ( ) . context (
67+ Err ( _) => corepc_node :: downloaded_exe_path ( ) . context (
6868 "you need to provide an env var BITCOIND_EXE or specify a bitcoind version feature" ,
6969 ) ?,
7070 } ;
71- let bitcoind = bitcoind :: BitcoinD :: with_conf ( bitcoind_exe, & config. bitcoind ) ?;
71+ let bitcoind = corepc_node :: Node :: with_conf ( bitcoind_exe, & config. bitcoind ) ?;
7272
7373 let electrs_exe = match std:: env:: var ( "ELECTRS_EXE" ) {
7474 Ok ( path) => path,
@@ -86,7 +86,7 @@ impl TestEnv {
8686 }
8787
8888 /// Exposes the [`RpcApi`] calls from [`bitcoincore_rpc`].
89- pub fn rpc_client ( & self ) -> & impl RpcApi {
89+ pub fn rpc_client ( & self ) -> & corepc_node :: Client {
9090 & self . bitcoind . client
9191 }
9292
@@ -117,16 +117,14 @@ impl TestEnv {
117117 ) -> anyhow:: Result < Vec < BlockHash > > {
118118 let coinbase_address = match address {
119119 Some ( address) => address,
120- None => self
121- . bitcoind
122- . client
123- . get_new_address ( None , None ) ?
124- . assume_checked ( ) ,
120+ None => self . bitcoind . client . new_address ( ) ?,
125121 } ;
126- let block_hashes = self
122+ let block_hashes: Vec < BlockHash > = self
127123 . bitcoind
128124 . client
129- . generate_to_address ( count as _ , & coinbase_address) ?;
125+ . generate_to_address ( count as _ , & coinbase_address) ?
126+ . into_model ( ) ?
127+ . 0 ;
130128 Ok ( block_hashes)
131129 }
132130
@@ -314,7 +312,7 @@ impl TestEnv {
314312mod test {
315313 use crate :: TestEnv ;
316314 use core:: time:: Duration ;
317- use electrsd:: bitcoind :: { anyhow:: Result , bitcoincore_rpc:: RpcApi } ;
315+ use electrsd:: corepc_node :: { anyhow:: Result , bitcoincore_rpc:: RpcApi } ;
318316
319317 /// This checks that reorgs initiated by `bitcoind` is detected by our `electrsd` instance.
320318 #[ test]
0 commit comments