Skip to content

Commit

Permalink
tests: early subscription to connectivity events for mempool sync
Browse files Browse the repository at this point in the history
  • Loading branch information
sdbondi committed Aug 31, 2021
1 parent 77c9256 commit 7808ade
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion base_layer/core/src/mempool/sync_protocol/initializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ impl ServiceInitializer for MempoolSyncInitializer {
context.spawn_until_shutdown(move |handles| async move {
let state_machine = handles.expect_handle::<StateMachineHandle>();
let connectivity = handles.expect_handle::<ConnectivityRequester>();
// Ensure that we get an subscription ASAP so that we don't miss any connectivity events
let connectivity_event_subscription = connectivity.get_event_subscription();

let mut status_watch = state_machine.get_status_info_watch();
if !status_watch.borrow().bootstrapped {
Expand All @@ -94,7 +96,7 @@ impl ServiceInitializer for MempoolSyncInitializer {
}
}

MempoolSyncProtocol::new(config, notif_rx, connectivity.get_event_subscription(), mempool)
MempoolSyncProtocol::new(config, notif_rx, connectivity_event_subscription, mempool)
.run()
.await;
});
Expand Down

0 comments on commit 7808ade

Please sign in to comment.