@@ -870,32 +870,79 @@ impl BlockchainFactory for RpcBlockchainFactory {
870870
871871#[ cfg( test) ]
872872#[ cfg( any( feature = "test-rpc" , feature = "test-rpc-legacy" ) ) ]
873- mod test {
873+ pub mod test {
874874 use super :: * ;
875- use crate :: {
876- descriptor:: { into_wallet_descriptor_checked , AsDerived } ,
877- testutils :: blockchain_tests :: TestClient ,
878- wallet :: utils :: SecpCtx ,
879- } ;
875+ use crate :: descriptor :: into_wallet_descriptor_checked ;
876+ use crate :: descriptor:: AsDerived ;
877+ use crate :: make_blockchain_tests ;
878+ use crate :: testutils :: blockchain_tests :: TestClient ;
879+ use crate :: wallet :: utils :: SecpCtx ;
880880
881881 use bitcoin:: { Address , Network } ;
882882 use bitcoincore_rpc:: RpcApi ;
883883 use log:: LevelFilter ;
884884 use miniscript:: DescriptorTrait ;
885885
886- crate :: bdk_blockchain_tests! {
887- fn test_instance( test_client: & TestClient ) -> RpcBlockchain {
888- let config = RpcConfig {
889- url: test_client. bitcoind. rpc_url( ) ,
890- auth: Auth :: Cookie { file: test_client. bitcoind. params. cookie_file. clone( ) } ,
891- network: Network :: Regtest ,
892- wallet_name: format!( "client-wallet-test-{}" , std:: time:: SystemTime :: now( ) . duration_since( std:: time:: UNIX_EPOCH ) . unwrap( ) . as_nanos( ) ) ,
893- sync_params: None ,
894- } ;
895- RpcBlockchain :: from_config( & config) . unwrap( )
896- }
886+ pub fn init_blockchain ( test_client : & TestClient ) -> RpcBlockchain {
887+ let config = RpcConfig {
888+ url : test_client. bitcoind . rpc_url ( ) ,
889+ auth : Auth :: Cookie {
890+ file : test_client. bitcoind . params . cookie_file . clone ( ) ,
891+ } ,
892+ network : Network :: Regtest ,
893+ wallet_name : format ! (
894+ "client-wallet-test-{}" ,
895+ std:: time:: SystemTime :: now( )
896+ . duration_since( std:: time:: UNIX_EPOCH )
897+ . unwrap( )
898+ . as_nanos( )
899+ ) ,
900+ sync_params : Some ( RpcSyncParams :: default ( ) ) ,
901+ } ;
902+ RpcBlockchain :: from_config ( & config) . unwrap ( )
897903 }
898904
905+ make_blockchain_tests ! [
906+ init_blockchain,
907+ tests(
908+ test_sync_simple,
909+ test_sync_stop_gap_20,
910+ test_sync_before_and_after_receive,
911+ test_sync_multiple_outputs_same_tx,
912+ test_sync_receive_multi,
913+ test_sync_address_reuse,
914+ test_sync_receive_rbf_replaced,
915+ test_sync_after_send,
916+ test_sync_address_index_should_not_decrement,
917+ test_sync_address_index_should_increment,
918+ test_sync_double_receive,
919+ test_sync_many_sends_to_a_single_address,
920+ test_update_confirmation_time_after_generate,
921+ test_sync_outgoing_from_scratch,
922+ test_sync_long_change_chain,
923+ test_sync_bump_fee_basic,
924+ test_sync_bump_fee_add_input_simple,
925+ test_sync_bump_fee_add_input_no_change,
926+ test_sync_receive_coinbase,
927+ test_double_spend,
928+ test_tx_chain,
929+ test_get_block_hash,
930+ )
931+ ] ;
932+
933+ #[ cfg( not( feature = "test-rpc-legacy" ) ) ]
934+ make_blockchain_tests ! [
935+ init_blockchain,
936+ tests(
937+ test_send_to_bech32m_addr,
938+ test_taproot_key_spend,
939+ test_taproot_script_spend,
940+ test_sign_taproot_core_keyspend_psbt,
941+ test_sign_taproot_core_scriptspend2_psbt,
942+ test_sign_taproot_core_scriptspend3_psbt,
943+ )
944+ ] ;
945+
899946 fn get_factory ( ) -> ( TestClient , RpcBlockchainFactory ) {
900947 let test_client = TestClient :: default ( ) ;
901948
0 commit comments