@@ -863,8 +863,12 @@ impl BlockchainFactory for RpcBlockchainFactory {
863863#[ cfg( test) ]
864864#[ cfg( any( feature = "test-rpc" , feature = "test-rpc-legacy" ) ) ]
865865mod test {
866+ use std:: time;
867+
866868 use super :: * ;
867- use crate :: testutils:: blockchain_tests:: TestClient ;
869+ use crate :: testutils:: {
870+ blockchain_tests:: TestClient , configurable_blockchain_tests:: ConfigurableBlockchainTester ,
871+ } ;
868872
869873 use bitcoin:: Network ;
870874 use bitcoincore_rpc:: RpcApi ;
@@ -921,4 +925,39 @@ mod test {
921925 "prefix-bbbbbb"
922926 ) ;
923927 }
928+
929+ #[ test]
930+ fn test_rpc_with_variable_configs ( ) {
931+ struct RpcTester ;
932+
933+ impl RpcTester {
934+ fn rand_wallet_name ( & self ) -> String {
935+ let now = time:: UNIX_EPOCH . elapsed ( ) . unwrap ( ) ;
936+ now. as_micros ( ) . to_string ( )
937+ }
938+ }
939+
940+ impl ConfigurableBlockchainTester < RpcBlockchain > for RpcTester {
941+ const BLOCKCHAIN_NAME : & ' static str = "Rpc" ;
942+
943+ fn config_with_stop_gap (
944+ & self ,
945+ test_client : & mut TestClient ,
946+ stop_gap : usize ,
947+ ) -> Option < <RpcBlockchain as ConfigurableBlockchain >:: Config > {
948+ Some ( RpcConfig {
949+ url : test_client. bitcoind . rpc_url ( ) ,
950+ auth : Auth :: Cookie {
951+ file : test_client. bitcoind . params . cookie_file . clone ( ) ,
952+ } ,
953+ network : Network :: Regtest ,
954+ wallet_name : self . rand_wallet_name ( ) ,
955+ sync_params : Some ( RpcSyncParams {
956+ stop_gap,
957+ ..Default :: default ( )
958+ } ) ,
959+ } )
960+ }
961+ }
962+ }
924963}
0 commit comments