Skip to content

Commit ab9769f

Browse files
committed
Allow outgoing splice request while disconnected
This is crucial for peers that serve liquidity for low-availability (i.e., mobile) nodes. We should allow users to queue a splice request while the peer is offline, such that it is negotiated once reconnected. Note that there currently isn't a way to time out/cancel these requests, this is planned for the near future.
1 parent 1802b6e commit ab9769f

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

lightning/src/ln/channel.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11851,10 +11851,10 @@ where
1185111851
});
1185211852
}
1185311853

11854-
if !self.context.is_live() {
11854+
if !self.context.is_usable() {
1185511855
return Err(APIError::APIMisuseError {
1185611856
err: format!(
11857-
"Channel {} cannot be spliced, as channel is not live",
11857+
"Channel {} cannot be spliced as it is either pending open/close",
1185811858
self.context.channel_id()
1185911859
),
1186011860
});
@@ -13017,13 +13017,15 @@ where
1301713017
|| self.context.channel_state.is_awaiting_quiescence()
1301813018
|| self.context.channel_state.is_local_stfu_sent()
1301913019
{
13020+
log_debug!(logger, "Channel is either pending quiescence or already quiescent");
1302013021
return Ok(None);
1302113022
}
1302213023

1302313024
self.context.channel_state.set_awaiting_quiescence();
1302413025
if self.context.is_live() {
1302513026
Ok(Some(self.send_stfu(logger)?))
1302613027
} else {
13028+
log_debug!(logger, "Waiting for peer reconnection to send stfu");
1302713029
Ok(None)
1302813030
}
1302913031
}

lightning/src/ln/channelmanager.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4728,14 +4728,6 @@ where
47284728
// Look for the channel
47294729
match peer_state.channel_by_id.entry(*channel_id) {
47304730
hash_map::Entry::Occupied(mut chan_phase_entry) => {
4731-
if !chan_phase_entry.get().context().is_connected() {
4732-
// TODO: We should probably support this, but right now `splice_channel` refuses when
4733-
// the peer is disconnected, so we just check it here.
4734-
return Err(APIError::ChannelUnavailable {
4735-
err: "Cannot initiate splice while peer is disconnected".to_owned(),
4736-
});
4737-
}
4738-
47394731
let locktime = locktime.unwrap_or_else(|| self.current_best_block().height);
47404732
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
47414733
let logger = WithChannelContext::from(&self.logger, &chan.context, None);

0 commit comments

Comments
 (0)