@@ -12,7 +12,7 @@ pub(crate) mod logging;
1212
1313use logging:: TestLogWriter ;
1414
15- use ldk_node:: config:: { Config , ElectrumSyncConfig , EsploraSyncConfig } ;
15+ use ldk_node:: config:: { BitcoindSyncClientConfig , Config , ElectrumSyncConfig , EsploraSyncConfig } ;
1616use ldk_node:: io:: sqlite_store:: SqliteStore ;
1717use ldk_node:: payment:: { PaymentDirection , PaymentKind , PaymentStatus } ;
1818use ldk_node:: {
@@ -174,6 +174,7 @@ pub(crate) fn setup_bitcoind_and_electrsd() -> (BitcoinD, ElectrsD) {
174174 ) ;
175175 let mut bitcoind_conf = corepc_node:: Conf :: default ( ) ;
176176 bitcoind_conf. network = "regtest" ;
177+ bitcoind_conf. args . push ( "-rest" ) ;
177178 let bitcoind = BitcoinD :: with_conf ( bitcoind_exe, & bitcoind_conf) . unwrap ( ) ;
178179
179180 let electrs_exe = env:: var ( "ELECTRS_EXE" )
@@ -256,7 +257,8 @@ type TestNode = Node;
256257pub ( crate ) enum TestChainSource < ' a > {
257258 Esplora ( & ' a ElectrsD ) ,
258259 Electrum ( & ' a ElectrsD ) ,
259- BitcoindRpc ( & ' a BitcoinD ) ,
260+ BitcoindRpcSync ( & ' a BitcoinD ) ,
261+ BitcoindRestSync ( & ' a BitcoinD ) ,
260262}
261263
262264#[ derive( Clone , Default ) ]
@@ -317,14 +319,30 @@ pub(crate) fn setup_node(
317319 let sync_config = ElectrumSyncConfig { background_sync_config : None } ;
318320 builder. set_chain_source_electrum ( electrum_url. clone ( ) , Some ( sync_config) ) ;
319321 } ,
320- TestChainSource :: BitcoindRpc ( bitcoind) => {
322+ TestChainSource :: BitcoindRpcSync ( bitcoind) => {
321323 let rpc_host = bitcoind. params . rpc_socket . ip ( ) . to_string ( ) ;
322324 let rpc_port = bitcoind. params . rpc_socket . port ( ) ;
323325 let values = bitcoind. params . get_cookie_values ( ) . unwrap ( ) . unwrap ( ) ;
324326 let rpc_user = values. user ;
325327 let rpc_password = values. password ;
326328 builder. set_chain_source_bitcoind ( rpc_host, rpc_port, rpc_user, rpc_password, None ) ;
327329 } ,
330+ TestChainSource :: BitcoindRestSync ( bitcoind) => {
331+ let rpc_host = bitcoind. params . rpc_socket . ip ( ) . to_string ( ) ;
332+ let rpc_port = bitcoind. params . rpc_socket . port ( ) ;
333+ let values = bitcoind. params . get_cookie_values ( ) . unwrap ( ) . unwrap ( ) ;
334+ let rpc_user = values. user ;
335+ let rpc_password = values. password ;
336+ let sync_client_config =
337+ BitcoindSyncClientConfig :: Rest { rest_host : rpc_host. clone ( ) , rest_port : rpc_port } ;
338+ builder. set_chain_source_bitcoind (
339+ rpc_host,
340+ rpc_port,
341+ rpc_user,
342+ rpc_password,
343+ Some ( sync_client_config) ,
344+ ) ;
345+ } ,
328346 }
329347
330348 match & config. log_writer {
0 commit comments