Skip to content

Commit fe2e09a

Browse files
Revert "fix(lsps4): track channel opens in flight to prevent stuck HTLC loop"
This reverts commit 1facb94.
1 parent 1facb94 commit fe2e09a

1 file changed

Lines changed: 5 additions & 18 deletions

File tree

lightning-liquidity/src/lsps4/service.rs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ where
101101
scid_store: ScidStore<L, K>,
102102
htlc_store: HTLCStore<L, K>,
103103
connected_peers: RwLock<HashSet<PublicKey>>,
104-
channel_opens_in_flight: RwLock<HashSet<PublicKey>>,
105104
config: LSPS4ServiceConfig,
106105
}
107106

@@ -129,7 +128,6 @@ where
129128
config,
130129
logger,
131130
connected_peers: RwLock::new(HashSet::new()),
132-
channel_opens_in_flight: RwLock::new(HashSet::new()),
133131
})
134132
}
135133

@@ -277,8 +275,6 @@ where
277275
pub fn channel_ready(
278276
&self, counterparty_node_id: &PublicKey,
279277
) -> Result<(), APIError> {
280-
self.channel_opens_in_flight.write().unwrap().remove(counterparty_node_id);
281-
282278
let is_connected = self.is_peer_connected(counterparty_node_id);
283279

284280
log_info!(
@@ -474,8 +470,6 @@ where
474470

475471
/// Will update the set of connected peers
476472
pub fn peer_disconnected(&self, counterparty_node_id: &PublicKey) {
477-
self.channel_opens_in_flight.write().unwrap().remove(counterparty_node_id);
478-
479473
let (was_present, remaining_count) = {
480474
let mut peers = self.connected_peers.write().unwrap();
481475
let was = peers.remove(counterparty_node_id);
@@ -531,23 +525,16 @@ where
531525
);
532526
let actions = self.calculate_htlc_actions_for_peer(node_id, htlcs);
533527
if actions.new_channel_needed_msat.is_some() {
534-
let already_in_flight = self.channel_opens_in_flight.read().unwrap().contains(&node_id);
535-
if already_in_flight {
536-
log_info!(
537-
self.logger,
538-
"[LSPS4] process_pending_htlcs: peer {} needs a new channel, \
539-
skipping (channel open already in flight)",
540-
node_id
541-
);
542-
continue;
543-
}
528+
// A channel open is already in flight from htlc_intercepted or
529+
// peer_connected. Skip — channel_ready will handle forwarding
530+
// once the new channel is established.
544531
log_info!(
545532
self.logger,
546533
"[LSPS4] process_pending_htlcs: peer {} needs a new channel, \
547-
triggering OpenChannel",
534+
skipping (channel open already in flight)",
548535
node_id
549536
);
550-
self.channel_opens_in_flight.write().unwrap().insert(node_id);
537+
continue;
551538
}
552539
self.execute_htlc_actions(actions, node_id);
553540
}

0 commit comments

Comments
 (0)