Skip to content

Commit 132ef2e

Browse files
committed
Drop redundant FilesystemStore initialization
1 parent ad6620d commit 132ef2e

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

src/main.rs

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,13 +1050,10 @@ async fn start_ldk() {
10501050
}
10511051
};
10521052

1053-
// Step 21: Persist ChannelManager and NetworkGraph
1054-
let persister = Arc::new(FilesystemStore::new(ldk_data_dir.clone().into()));
1055-
1056-
// Step 22: Background Processing
1053+
// Step 21: Background Processing
10571054
let (bp_exit, bp_exit_check) = tokio::sync::watch::channel(());
10581055
let mut background_processor = tokio::spawn(process_events_async(
1059-
Arc::clone(&persister),
1056+
Arc::clone(&fs_store),
10601057
event_handler,
10611058
Arc::clone(&chain_monitor),
10621059
Arc::clone(&channel_manager),
@@ -1157,27 +1154,25 @@ async fn start_ldk() {
11571154
ldk_data_dir.clone(),
11581155
Arc::clone(&keys_manager),
11591156
Arc::clone(&logger),
1160-
Arc::clone(&persister),
1157+
Arc::clone(&fs_store),
11611158
Arc::clone(&output_sweeper),
11621159
));
11631160

11641161
// Start the CLI.
11651162
let cli_channel_manager = Arc::clone(&channel_manager);
11661163
let cli_chain_monitor = Arc::clone(&chain_monitor);
1167-
let cli_persister = Arc::clone(&persister);
1164+
let cli_fs_store = Arc::clone(&fs_store);
11681165
let cli_peer_manager = Arc::clone(&peer_manager);
1169-
let cli_poll = tokio::task::spawn(
1170-
cli::poll_for_user_input(
1171-
cli_peer_manager,
1172-
cli_channel_manager,
1173-
cli_chain_monitor,
1174-
keys_manager,
1175-
network_graph,
1176-
inbound_payments,
1177-
outbound_payments,
1178-
cli_persister,
1179-
)
1180-
);
1166+
let cli_poll = tokio::task::spawn(cli::poll_for_user_input(
1167+
cli_peer_manager,
1168+
cli_channel_manager,
1169+
cli_chain_monitor,
1170+
keys_manager,
1171+
network_graph,
1172+
inbound_payments,
1173+
outbound_payments,
1174+
cli_fs_store,
1175+
));
11811176

11821177
// Exit if either CLI polling exits or the background processor exits (which shouldn't happen
11831178
// unless we fail to write to the filesystem).
@@ -1195,7 +1190,7 @@ async fn start_ldk() {
11951190
peer_manager.disconnect_all_peers();
11961191

11971192
if let Err(e) = bg_res {
1198-
let persist_res = persister
1193+
let persist_res = fs_store
11991194
.write(
12001195
persist::CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE,
12011196
persist::CHANNEL_MANAGER_PERSISTENCE_SECONDARY_NAMESPACE,

0 commit comments

Comments
 (0)