@@ -15,8 +15,8 @@ use crate::peer_store::PeerStore;
1515use crate :: sweep:: OutputSweeper ;
1616use crate :: tx_broadcaster:: TransactionBroadcaster ;
1717use crate :: types:: {
18- ChainMonitor , ChannelManager , FakeMessageRouter , GossipSync , KeysManager , NetworkGraph ,
19- OnionMessenger , PeerManager ,
18+ ChainMonitor , ChannelManager , DynStore , FakeMessageRouter , GossipSync , KeysManager ,
19+ NetworkGraph , OnionMessenger , PeerManager ,
2020} ;
2121use crate :: wallet:: Wallet ;
2222use crate :: { LogLevel , Node } ;
@@ -33,7 +33,7 @@ use lightning::sign::EntropySource;
3333
3434use lightning:: util:: config:: UserConfig ;
3535use lightning:: util:: persist:: {
36- read_channel_monitors, KVStore , CHANNEL_MANAGER_PERSISTENCE_KEY ,
36+ read_channel_monitors, CHANNEL_MANAGER_PERSISTENCE_KEY ,
3737 CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE , CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE ,
3838} ;
3939use lightning:: util:: ser:: ReadableArgs ;
@@ -114,12 +114,18 @@ pub enum BuildError {
114114 /// The given listening addresses are invalid, e.g. too many were passed.
115115 InvalidListeningAddresses ,
116116 /// We failed to read data from the [`KVStore`].
117+ ///
118+ /// [`KVStore`]: lightning::util::persist::KVStore
117119 ReadFailed ,
118120 /// We failed to write data to the [`KVStore`].
121+ ///
122+ /// [`KVStore`]: lightning::util::persist::KVStore
119123 WriteFailed ,
120124 /// We failed to access the given `storage_dir_path`.
121125 StoragePathAccessFailed ,
122126 /// We failed to setup our [`KVStore`].
127+ ///
128+ /// [`KVStore`]: lightning::util::persist::KVStore
123129 KVStoreSetupFailed ,
124130 /// We failed to setup the onchain wallet.
125131 WalletSetupFailed ,
@@ -298,7 +304,7 @@ impl NodeBuilder {
298304
299305 /// Builds a [`Node`] instance with a [`SqliteStore`] backend and according to the options
300306 /// previously configured.
301- pub fn build ( & self ) -> Result < Node < SqliteStore > , BuildError > {
307+ pub fn build ( & self ) -> Result < Node , BuildError > {
302308 let storage_dir_path = self . config . storage_dir_path . clone ( ) ;
303309 fs:: create_dir_all ( storage_dir_path. clone ( ) )
304310 . map_err ( |_| BuildError :: StoragePathAccessFailed ) ?;
@@ -315,7 +321,7 @@ impl NodeBuilder {
315321
316322 /// Builds a [`Node`] instance with a [`FilesystemStore`] backend and according to the options
317323 /// previously configured.
318- pub fn build_with_fs_store ( & self ) -> Result < Node < FilesystemStore > , BuildError > {
324+ pub fn build_with_fs_store ( & self ) -> Result < Node , BuildError > {
319325 let mut storage_dir_path: PathBuf = self . config . storage_dir_path . clone ( ) . into ( ) ;
320326 storage_dir_path. push ( "fs_store" ) ;
321327
@@ -328,9 +334,7 @@ impl NodeBuilder {
328334 /// Builds a [`Node`] instance with a [`VssStore`] backend and according to the options
329335 /// previously configured.
330336 #[ cfg( any( vss, vss_test) ) ]
331- pub fn build_with_vss_store (
332- & self , url : String , store_id : String ,
333- ) -> Result < Node < VssStore > , BuildError > {
337+ pub fn build_with_vss_store ( & self , url : String , store_id : String ) -> Result < Node , BuildError > {
334338 let logger = setup_logger ( & self . config ) ?;
335339
336340 let seed_bytes = seed_bytes_from_config (
@@ -368,9 +372,7 @@ impl NodeBuilder {
368372 }
369373
370374 /// Builds a [`Node`] instance according to the options previously configured.
371- pub fn build_with_store < K : KVStore + Sync + Send + ' static > (
372- & self , kv_store : Arc < K > ,
373- ) -> Result < Node < K > , BuildError > {
375+ pub fn build_with_store ( & self , kv_store : Arc < DynStore > ) -> Result < Node , BuildError > {
374376 let logger = setup_logger ( & self . config ) ?;
375377 let seed_bytes = seed_bytes_from_config (
376378 & self . config ,
@@ -499,31 +501,29 @@ impl ArcedNodeBuilder {
499501
500502 /// Builds a [`Node`] instance with a [`SqliteStore`] backend and according to the options
501503 /// previously configured.
502- pub fn build ( & self ) -> Result < Arc < Node < SqliteStore > > , BuildError > {
504+ pub fn build ( & self ) -> Result < Arc < Node > , BuildError > {
503505 self . inner . read ( ) . unwrap ( ) . build ( ) . map ( Arc :: new)
504506 }
505507
506508 /// Builds a [`Node`] instance with a [`FilesystemStore`] backend and according to the options
507509 /// previously configured.
508- pub fn build_with_fs_store ( & self ) -> Result < Arc < Node < FilesystemStore > > , BuildError > {
510+ pub fn build_with_fs_store ( & self ) -> Result < Arc < Node > , BuildError > {
509511 self . inner . read ( ) . unwrap ( ) . build_with_fs_store ( ) . map ( Arc :: new)
510512 }
511513
512514 /// Builds a [`Node`] instance according to the options previously configured.
513- pub fn build_with_store < K : KVStore + Sync + Send + ' static > (
514- & self , kv_store : Arc < K > ,
515- ) -> Result < Arc < Node < K > > , BuildError > {
515+ pub fn build_with_store ( & self , kv_store : Arc < DynStore > ) -> Result < Arc < Node > , BuildError > {
516516 self . inner . read ( ) . unwrap ( ) . build_with_store ( kv_store) . map ( Arc :: new)
517517 }
518518}
519519
520520/// Builds a [`Node`] instance according to the options previously configured.
521- fn build_with_store_internal < K : KVStore + Sync + Send + ' static > (
521+ fn build_with_store_internal (
522522 config : Arc < Config > , chain_data_source_config : Option < & ChainDataSourceConfig > ,
523523 gossip_source_config : Option < & GossipSourceConfig > ,
524524 liquidity_source_config : Option < & LiquiditySourceConfig > , seed_bytes : [ u8 ; 64 ] ,
525- logger : Arc < FilesystemLogger > , kv_store : Arc < K > ,
526- ) -> Result < Node < K > , BuildError > {
525+ logger : Arc < FilesystemLogger > , kv_store : Arc < DynStore > ,
526+ ) -> Result < Node , BuildError > {
527527 // Initialize the on-chain wallet and chain access
528528 let xprv = bitcoin:: bip32:: ExtendedPrivKey :: new_master ( config. network . into ( ) , & seed_bytes)
529529 . map_err ( |e| {
@@ -603,7 +603,7 @@ fn build_with_store_internal<K: KVStore + Sync + Send + 'static>(
603603 ) ) ;
604604
605605 // Initialize the ChainMonitor
606- let chain_monitor: Arc < ChainMonitor < K > > = Arc :: new ( chainmonitor:: ChainMonitor :: new (
606+ let chain_monitor: Arc < ChainMonitor > = Arc :: new ( chainmonitor:: ChainMonitor :: new (
607607 Some ( Arc :: clone ( & tx_sync) ) ,
608608 Arc :: clone ( & tx_broadcaster) ,
609609 Arc :: clone ( & logger) ,
@@ -734,7 +734,7 @@ fn build_with_store_internal<K: KVStore + Sync + Send + 'static>(
734734 channel_monitor_references,
735735 ) ;
736736 let ( _hash, channel_manager) =
737- <( BlockHash , ChannelManager < K > ) >:: read ( & mut reader, read_args) . map_err ( |e| {
737+ <( BlockHash , ChannelManager ) >:: read ( & mut reader, read_args) . map_err ( |e| {
738738 log_error ! ( logger, "Failed to read channel manager from KVStore: {}" , e) ;
739739 BuildError :: ReadFailed
740740 } ) ?;
0 commit comments