Skip to content

Commit a70375b

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 a889bac commit a70375b

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
@@ -11602,10 +11602,10 @@ where
1160211602
});
1160311603
}
1160411604

11605-
if !self.context.is_live() {
11605+
if !self.context.is_usable() {
1160611606
return Err(APIError::APIMisuseError {
1160711607
err: format!(
11608-
"Channel {} cannot be spliced, as channel is not live",
11608+
"Channel {} cannot be spliced as it is either pending open/close",
1160911609
self.context.channel_id()
1161011610
),
1161111611
});
@@ -12751,13 +12751,15 @@ where
1275112751
|| self.context.channel_state.is_awaiting_quiescence()
1275212752
|| self.context.channel_state.is_local_stfu_sent()
1275312753
{
12754+
log_info!(logger, "Channel is either pending or already quiescent");
1275412755
return Ok(None);
1275512756
}
1275612757

1275712758
self.context.channel_state.set_awaiting_quiescence();
1275812759
if self.context.is_live() {
1275912760
Ok(Some(self.send_stfu(logger)?))
1276012761
} else {
12762+
log_info!(logger, "Waiting for peer reconnection to send stfu");
1276112763
Ok(None)
1276212764
}
1276312765
}

lightning/src/ln/channelmanager.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4682,14 +4682,6 @@ where
46824682
// Look for the channel
46834683
match peer_state.channel_by_id.entry(*channel_id) {
46844684
hash_map::Entry::Occupied(mut chan_phase_entry) => {
4685-
if !chan_phase_entry.get().context().is_connected() {
4686-
// TODO: We should probably support this, but right now `splice_channel` refuses when
4687-
// the peer is disconnected, so we just check it here.
4688-
return Err(APIError::ChannelUnavailable {
4689-
err: "Cannot initiate splice while peer is disconnected".to_owned(),
4690-
});
4691-
}
4692-
46934685
let locktime = locktime.unwrap_or_else(|| self.current_best_block().height);
46944686
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
46954687
let logger = WithChannelContext::from(&self.logger, &chan.context, None);

0 commit comments

Comments
 (0)