@@ -14,7 +14,7 @@ use crate::payment_store::PaymentStore;
14
14
use crate :: peer_store:: PeerStore ;
15
15
use crate :: tx_broadcaster:: TransactionBroadcaster ;
16
16
use crate :: types:: {
17
- ChainMonitor , ChannelManager , GossipSync , KeysManager , MessageRouter , NetworkGraph ,
17
+ ChainMonitor , ChannelManager , DynStore , GossipSync , KeysManager , MessageRouter , NetworkGraph ,
18
18
OnionMessenger , PeerManager ,
19
19
} ;
20
20
use crate :: wallet:: Wallet ;
@@ -32,7 +32,7 @@ use lightning::sign::EntropySource;
32
32
33
33
use lightning:: util:: config:: UserConfig ;
34
34
use lightning:: util:: persist:: {
35
- read_channel_monitors, KVStore , CHANNEL_MANAGER_PERSISTENCE_KEY ,
35
+ read_channel_monitors, CHANNEL_MANAGER_PERSISTENCE_KEY ,
36
36
CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE , CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE ,
37
37
} ;
38
38
use lightning:: util:: ser:: ReadableArgs ;
@@ -115,12 +115,18 @@ pub enum BuildError {
115
115
/// The given listening addresses are invalid, e.g. too many were passed.
116
116
InvalidListeningAddresses ,
117
117
/// We failed to read data from the [`KVStore`].
118
+ ///
119
+ /// [`KVStore`]: lightning::util::persist::KVStore
118
120
ReadFailed ,
119
121
/// We failed to write data to the [`KVStore`].
122
+ ///
123
+ /// [`KVStore`]: lightning::util::persist::KVStore
120
124
WriteFailed ,
121
125
/// We failed to access the given `storage_dir_path`.
122
126
StoragePathAccessFailed ,
123
127
/// We failed to setup our [`KVStore`].
128
+ ///
129
+ /// [`KVStore`]: lightning::util::persist::KVStore
124
130
KVStoreSetupFailed ,
125
131
/// We failed to setup the onchain wallet.
126
132
WalletSetupFailed ,
@@ -299,7 +305,7 @@ impl NodeBuilder {
299
305
300
306
/// Builds a [`Node`] instance with a [`SqliteStore`] backend and according to the options
301
307
/// previously configured.
302
- pub fn build ( & self ) -> Result < Node < SqliteStore > , BuildError > {
308
+ pub fn build ( & self ) -> Result < Node , BuildError > {
303
309
let storage_dir_path = self . config . storage_dir_path . clone ( ) ;
304
310
fs:: create_dir_all ( storage_dir_path. clone ( ) )
305
311
. map_err ( |_| BuildError :: StoragePathAccessFailed ) ?;
@@ -316,7 +322,7 @@ impl NodeBuilder {
316
322
317
323
/// Builds a [`Node`] instance with a [`FilesystemStore`] backend and according to the options
318
324
/// previously configured.
319
- pub fn build_with_fs_store ( & self ) -> Result < Node < FilesystemStore > , BuildError > {
325
+ pub fn build_with_fs_store ( & self ) -> Result < Node , BuildError > {
320
326
let mut storage_dir_path: PathBuf = self . config . storage_dir_path . clone ( ) . into ( ) ;
321
327
storage_dir_path. push ( "fs_store" ) ;
322
328
@@ -329,9 +335,7 @@ impl NodeBuilder {
329
335
/// Builds a [`Node`] instance with a [`VssStore`] backend and according to the options
330
336
/// previously configured.
331
337
#[ cfg( any( vss, vss_test) ) ]
332
- pub fn build_with_vss_store (
333
- & self , url : String , store_id : String ,
334
- ) -> Result < Node < VssStore > , BuildError > {
338
+ pub fn build_with_vss_store ( & self , url : String , store_id : String ) -> Result < Node , BuildError > {
335
339
let logger = setup_logger ( & self . config ) ?;
336
340
337
341
let seed_bytes = seed_bytes_from_config (
@@ -369,9 +373,7 @@ impl NodeBuilder {
369
373
}
370
374
371
375
/// Builds a [`Node`] instance according to the options previously configured.
372
- pub fn build_with_store < K : KVStore + Sync + Send + ' static > (
373
- & self , kv_store : Arc < K > ,
374
- ) -> Result < Node < K > , BuildError > {
376
+ pub fn build_with_store ( & self , kv_store : Arc < DynStore > ) -> Result < Node , BuildError > {
375
377
let logger = setup_logger ( & self . config ) ?;
376
378
let seed_bytes = seed_bytes_from_config (
377
379
& self . config ,
@@ -500,31 +502,29 @@ impl ArcedNodeBuilder {
500
502
501
503
/// Builds a [`Node`] instance with a [`SqliteStore`] backend and according to the options
502
504
/// previously configured.
503
- pub fn build ( & self ) -> Result < Arc < Node < SqliteStore > > , BuildError > {
505
+ pub fn build ( & self ) -> Result < Arc < Node > , BuildError > {
504
506
self . inner . read ( ) . unwrap ( ) . build ( ) . map ( Arc :: new)
505
507
}
506
508
507
509
/// Builds a [`Node`] instance with a [`FilesystemStore`] backend and according to the options
508
510
/// previously configured.
509
- pub fn build_with_fs_store ( & self ) -> Result < Arc < Node < FilesystemStore > > , BuildError > {
511
+ pub fn build_with_fs_store ( & self ) -> Result < Arc < Node > , BuildError > {
510
512
self . inner . read ( ) . unwrap ( ) . build_with_fs_store ( ) . map ( Arc :: new)
511
513
}
512
514
513
515
/// Builds a [`Node`] instance according to the options previously configured.
514
- pub fn build_with_store < K : KVStore + Sync + Send + ' static > (
515
- & self , kv_store : Arc < K > ,
516
- ) -> Result < Arc < Node < K > > , BuildError > {
516
+ pub fn build_with_store ( & self , kv_store : Arc < DynStore > ) -> Result < Arc < Node > , BuildError > {
517
517
self . inner . read ( ) . unwrap ( ) . build_with_store ( kv_store) . map ( Arc :: new)
518
518
}
519
519
}
520
520
521
521
/// Builds a [`Node`] instance according to the options previously configured.
522
- fn build_with_store_internal < K : KVStore + Sync + Send + ' static > (
522
+ fn build_with_store_internal (
523
523
config : Arc < Config > , chain_data_source_config : Option < & ChainDataSourceConfig > ,
524
524
gossip_source_config : Option < & GossipSourceConfig > ,
525
525
liquidity_source_config : Option < & LiquiditySourceConfig > , seed_bytes : [ u8 ; 64 ] ,
526
- logger : Arc < FilesystemLogger > , kv_store : Arc < K > ,
527
- ) -> Result < Node < K > , BuildError > {
526
+ logger : Arc < FilesystemLogger > , kv_store : Arc < DynStore > ,
527
+ ) -> Result < Node , BuildError > {
528
528
// Initialize the on-chain wallet and chain access
529
529
let xprv = bitcoin:: bip32:: ExtendedPrivKey :: new_master ( config. network . into ( ) , & seed_bytes)
530
530
. map_err ( |e| {
@@ -604,7 +604,7 @@ fn build_with_store_internal<K: KVStore + Sync + Send + 'static>(
604
604
) ) ;
605
605
606
606
// Initialize the ChainMonitor
607
- let chain_monitor: Arc < ChainMonitor < K > > = Arc :: new ( chainmonitor:: ChainMonitor :: new (
607
+ let chain_monitor: Arc < ChainMonitor > = Arc :: new ( chainmonitor:: ChainMonitor :: new (
608
608
Some ( Arc :: clone ( & tx_sync) ) ,
609
609
Arc :: clone ( & tx_broadcaster) ,
610
610
Arc :: clone ( & logger) ,
@@ -735,7 +735,7 @@ fn build_with_store_internal<K: KVStore + Sync + Send + 'static>(
735
735
channel_monitor_references,
736
736
) ;
737
737
let ( _hash, channel_manager) =
738
- <( BlockHash , ChannelManager < K > ) >:: read ( & mut reader, read_args) . map_err ( |e| {
738
+ <( BlockHash , ChannelManager ) >:: read ( & mut reader, read_args) . map_err ( |e| {
739
739
log_error ! ( logger, "Failed to read channel manager from KVStore: {}" , e) ;
740
740
BuildError :: ReadFailed
741
741
} ) ?;
@@ -779,7 +779,7 @@ fn build_with_store_internal<K: KVStore + Sync + Send + 'static>(
779
779
let message_router = MessageRouter :: new ( Arc :: clone ( & network_graph) , Arc :: clone ( & keys_manager) ) ;
780
780
781
781
// Initialize the PeerManager
782
- let onion_messenger: Arc < OnionMessenger < K > > = Arc :: new ( OnionMessenger :: new (
782
+ let onion_messenger: Arc < OnionMessenger > = Arc :: new ( OnionMessenger :: new (
783
783
Arc :: clone ( & keys_manager) ,
784
784
Arc :: clone ( & keys_manager) ,
785
785
Arc :: clone ( & logger) ,
0 commit comments