Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ impl Node {
// First tick fires immediately; consume it so we don't run at t=0.
pending_htlc_interval.tick().await;
expiry_check_interval.tick().await;
let lm = liquidity_handler.liquidity_manager();
loop {
tokio::select! {
_ = stop_liquidity_handler.changed() => {
Expand All @@ -666,7 +667,9 @@ impl Node {
_ = expiry_check_interval.tick() => {
liquidity_handler.handle_expired_htlcs().await;
}
_ = liquidity_handler.handle_next_event() => {}
event = lm.next_event_async() => {
liquidity_handler.handle_event(event).await;
}
}
}
});
Expand Down
8 changes: 6 additions & 2 deletions src/liquidity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,12 @@ where
}
}

pub(crate) async fn handle_next_event(&self) {
match self.liquidity_manager.next_event_async().await {
/// Handles a single liquidity event. Must be called from a context that
/// guarantees the future runs to completion (e.g. a `select!` handler block),
/// since event processing includes `.await` points that are not
/// cancellation-safe.
pub(crate) async fn handle_event(&self, event: LiquidityEvent) {
match event {
LiquidityEvent::LSPS1Client(LSPS1ClientEvent::SupportedOptionsReady {
request_id,
counterparty_node_id,
Expand Down
Loading