@@ -78,6 +78,7 @@ use std::time::SystemTime;
7878#[ derive( Debug , Clone ) ]
7979enum ChainDataSourceConfig {
8080 Esplora { server_url : String , sync_config : Option < EsploraSyncConfig > } ,
81+ BitcoindRpc { rpc_host : String , rpc_port : u16 , rpc_user : String , rpc_password : String } ,
8182}
8283
8384#[ derive( Debug , Clone ) ]
@@ -248,6 +249,16 @@ impl NodeBuilder {
248249 self
249250 }
250251
252+ /// Configures the [`Node`] instance to source its chain data from the given Bitcoin Core RPC
253+ /// endpoint.
254+ pub fn set_chain_source_bitcoind_rpc (
255+ & mut self , rpc_host : String , rpc_port : u16 , rpc_user : String , rpc_password : String ,
256+ ) -> & mut Self {
257+ self . chain_data_source_config =
258+ Some ( ChainDataSourceConfig :: BitcoindRpc { rpc_host, rpc_port, rpc_user, rpc_password } ) ;
259+ self
260+ }
261+
251262 /// Configures the [`Node`] instance to source its gossip data from the Lightning peer-to-peer
252263 /// network.
253264 pub fn set_gossip_source_p2p ( & mut self ) -> & mut Self {
@@ -479,6 +490,19 @@ impl ArcedNodeBuilder {
479490 self . inner . write ( ) . unwrap ( ) . set_chain_source_esplora ( server_url, sync_config) ;
480491 }
481492
493+ /// Configures the [`Node`] instance to source its chain data from the given Bitcoin Core RPC
494+ /// endpoint.
495+ pub fn set_chain_source_bitcoind_rpc (
496+ & self , rpc_host : String , rpc_port : u16 , rpc_user : String , rpc_password : String ,
497+ ) {
498+ self . inner . write ( ) . unwrap ( ) . set_chain_source_bitcoind_rpc (
499+ rpc_host,
500+ rpc_port,
501+ rpc_user,
502+ rpc_password,
503+ ) ;
504+ }
505+
482506 /// Configures the [`Node`] instance to source its gossip data from the Lightning peer-to-peer
483507 /// network.
484508 pub fn set_gossip_source_p2p ( & self ) {
@@ -633,6 +657,21 @@ fn build_with_store_internal(
633657 Arc :: clone ( & node_metrics) ,
634658 ) )
635659 } ,
660+ Some ( ChainDataSourceConfig :: BitcoindRpc { rpc_host, rpc_port, rpc_user, rpc_password } ) => {
661+ Arc :: new ( ChainSource :: new_bitcoind_rpc (
662+ rpc_host. clone ( ) ,
663+ * rpc_port,
664+ rpc_user. clone ( ) ,
665+ rpc_password. clone ( ) ,
666+ Arc :: clone ( & wallet) ,
667+ Arc :: clone ( & fee_estimator) ,
668+ Arc :: clone ( & tx_broadcaster) ,
669+ Arc :: clone ( & kv_store) ,
670+ Arc :: clone ( & config) ,
671+ Arc :: clone ( & logger) ,
672+ Arc :: clone ( & node_metrics) ,
673+ ) )
674+ } ,
636675 None => {
637676 // Default to Esplora client.
638677 let server_url = DEFAULT_ESPLORA_SERVER_URL . to_string ( ) ;
0 commit comments