@@ -9,8 +9,8 @@ use crate::peer_store::PeerStore;
99use crate :: sweep:: OutputSweeper ;
1010use crate :: tx_broadcaster:: TransactionBroadcaster ;
1111use crate :: types:: {
12- ChainMonitor , ChannelManager , FakeMessageRouter , GossipSync , KeysManager , NetworkGraph ,
13- OnionMessenger , PeerManager ,
12+ ChainMonitor , ChannelManager , DynStore , FakeMessageRouter , GossipSync , KeysManager ,
13+ NetworkGraph , OnionMessenger , PeerManager ,
1414} ;
1515use crate :: wallet:: Wallet ;
1616use crate :: LogLevel ;
@@ -31,7 +31,7 @@ use lightning::sign::EntropySource;
3131
3232use lightning:: util:: config:: UserConfig ;
3333use lightning:: util:: persist:: {
34- read_channel_monitors, KVStore , CHANNEL_MANAGER_PERSISTENCE_KEY ,
34+ read_channel_monitors, CHANNEL_MANAGER_PERSISTENCE_KEY ,
3535 CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE , CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE ,
3636} ;
3737use lightning:: util:: ser:: ReadableArgs ;
@@ -96,12 +96,18 @@ pub enum BuildError {
9696 /// The given listening addresses are invalid, e.g. too many were passed.
9797 InvalidListeningAddresses ,
9898 /// We failed to read data from the [`KVStore`].
99+ ///
100+ /// [`KVStore`]: lightning::util::persist::KVStore
99101 ReadFailed ,
100102 /// We failed to write data to the [`KVStore`].
103+ ///
104+ /// [`KVStore`]: lightning::util::persist::KVStore
101105 WriteFailed ,
102106 /// We failed to access the given `storage_dir_path`.
103107 StoragePathAccessFailed ,
104108 /// We failed to setup our [`KVStore`].
109+ ///
110+ /// [`KVStore`]: lightning::util::persist::KVStore
105111 KVStoreSetupFailed ,
106112 /// We failed to setup the onchain wallet.
107113 WalletSetupFailed ,
@@ -256,7 +262,7 @@ impl NodeBuilder {
256262
257263 /// Builds a [`Node`] instance with a [`SqliteStore`] backend and according to the options
258264 /// previously configured.
259- pub fn build ( & self ) -> Result < Node < SqliteStore > , BuildError > {
265+ pub fn build ( & self ) -> Result < Node , BuildError > {
260266 let storage_dir_path = self . config . storage_dir_path . clone ( ) ;
261267 fs:: create_dir_all ( storage_dir_path. clone ( ) )
262268 . map_err ( |_| BuildError :: StoragePathAccessFailed ) ?;
@@ -273,7 +279,7 @@ impl NodeBuilder {
273279
274280 /// Builds a [`Node`] instance with a [`FilesystemStore`] backend and according to the options
275281 /// previously configured.
276- pub fn build_with_fs_store ( & self ) -> Result < Node < FilesystemStore > , BuildError > {
282+ pub fn build_with_fs_store ( & self ) -> Result < Node , BuildError > {
277283 let mut storage_dir_path: PathBuf = self . config . storage_dir_path . clone ( ) . into ( ) ;
278284 storage_dir_path. push ( "fs_store" ) ;
279285
@@ -286,9 +292,7 @@ impl NodeBuilder {
286292 /// Builds a [`Node`] instance with a [`VssStore`] backend and according to the options
287293 /// previously configured.
288294 #[ cfg( any( vss, vss_test) ) ]
289- pub fn build_with_vss_store (
290- & self , url : String , store_id : String ,
291- ) -> Result < Node < VssStore > , BuildError > {
295+ pub fn build_with_vss_store ( & self , url : String , store_id : String ) -> Result < Node , BuildError > {
292296 let logger = setup_logger ( & self . config ) ?;
293297
294298 let seed_bytes = seed_bytes_from_config (
@@ -325,9 +329,7 @@ impl NodeBuilder {
325329 }
326330
327331 /// Builds a [`Node`] instance according to the options previously configured.
328- pub fn build_with_store < K : KVStore + Sync + Send + ' static > (
329- & self , kv_store : Arc < K > ,
330- ) -> Result < Node < K > , BuildError > {
332+ pub fn build_with_store ( & self , kv_store : Arc < DynStore > ) -> Result < Node , BuildError > {
331333 let logger = setup_logger ( & self . config ) ?;
332334 let seed_bytes = seed_bytes_from_config (
333335 & self . config ,
@@ -442,30 +444,28 @@ impl ArcedNodeBuilder {
442444
443445 /// Builds a [`Node`] instance with a [`SqliteStore`] backend and according to the options
444446 /// previously configured.
445- pub fn build ( & self ) -> Result < Arc < Node < SqliteStore > > , BuildError > {
447+ pub fn build ( & self ) -> Result < Arc < Node > , BuildError > {
446448 self . inner . read ( ) . unwrap ( ) . build ( ) . map ( Arc :: new)
447449 }
448450
449451 /// Builds a [`Node`] instance with a [`FilesystemStore`] backend and according to the options
450452 /// previously configured.
451- pub fn build_with_fs_store ( & self ) -> Result < Arc < Node < FilesystemStore > > , BuildError > {
453+ pub fn build_with_fs_store ( & self ) -> Result < Arc < Node > , BuildError > {
452454 self . inner . read ( ) . unwrap ( ) . build_with_fs_store ( ) . map ( Arc :: new)
453455 }
454456
455457 /// Builds a [`Node`] instance according to the options previously configured.
456- pub fn build_with_store < K : KVStore + Sync + Send + ' static > (
457- & self , kv_store : Arc < K > ,
458- ) -> Result < Arc < Node < K > > , BuildError > {
458+ pub fn build_with_store ( & self , kv_store : Arc < DynStore > ) -> Result < Arc < Node > , BuildError > {
459459 self . inner . read ( ) . unwrap ( ) . build_with_store ( kv_store) . map ( Arc :: new)
460460 }
461461}
462462
463463/// Builds a [`Node`] instance according to the options previously configured.
464- fn build_with_store_internal < K : KVStore + Sync + Send + ' static > (
464+ fn build_with_store_internal (
465465 config : Arc < Config > , chain_data_source_config : Option < & ChainDataSourceConfig > ,
466466 gossip_source_config : Option < & GossipSourceConfig > , seed_bytes : [ u8 ; 64 ] ,
467- logger : Arc < FilesystemLogger > , kv_store : Arc < K > ,
468- ) -> Result < Node < K > , BuildError > {
467+ logger : Arc < FilesystemLogger > , kv_store : Arc < DynStore > ,
468+ ) -> Result < Node , BuildError > {
469469 // Initialize the on-chain wallet and chain access
470470 let xprv = bitcoin:: bip32:: ExtendedPrivKey :: new_master ( config. network . into ( ) , & seed_bytes)
471471 . map_err ( |e| {
@@ -545,7 +545,7 @@ fn build_with_store_internal<K: KVStore + Sync + Send + 'static>(
545545 ) ) ;
546546
547547 // Initialize the ChainMonitor
548- let chain_monitor: Arc < ChainMonitor < K > > = Arc :: new ( chainmonitor:: ChainMonitor :: new (
548+ let chain_monitor: Arc < ChainMonitor > = Arc :: new ( chainmonitor:: ChainMonitor :: new (
549549 Some ( Arc :: clone ( & tx_sync) ) ,
550550 Arc :: clone ( & tx_broadcaster) ,
551551 Arc :: clone ( & logger) ,
@@ -658,7 +658,7 @@ fn build_with_store_internal<K: KVStore + Sync + Send + 'static>(
658658 channel_monitor_references,
659659 ) ;
660660 let ( _hash, channel_manager) =
661- <( BlockHash , ChannelManager < K > ) >:: read ( & mut reader, read_args) . map_err ( |e| {
661+ <( BlockHash , ChannelManager ) >:: read ( & mut reader, read_args) . map_err ( |e| {
662662 log_error ! ( logger, "Failed to read channel manager from KVStore: {}" , e) ;
663663 BuildError :: ReadFailed
664664 } ) ?;
0 commit comments