Skip to content

Commit 2d9ed03

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 1a0b87a commit 2d9ed03

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
@@ -11507,10 +11507,10 @@ where
1150711507
});
1150811508
}
1150911509

11510-
if !self.context.is_live() {
11510+
if !self.context.is_usable() {
1151111511
return Err(APIError::APIMisuseError {
1151211512
err: format!(
11513-
"Channel {} cannot be spliced, as channel is not live",
11513+
"Channel {} cannot be spliced as it is either pending open/close",
1151411514
self.context.channel_id()
1151511515
),
1151611516
});
@@ -12656,13 +12656,15 @@ where
1265612656
|| self.context.channel_state.is_awaiting_quiescence()
1265712657
|| self.context.channel_state.is_local_stfu_sent()
1265812658
{
12659+
log_info!(logger, "Channel is either pending or already quiescent");
1265912660
return Ok(None);
1266012661
}
1266112662

1266212663
self.context.channel_state.set_awaiting_quiescence();
1266312664
if self.context.is_live() {
1266412665
Ok(Some(self.send_stfu(logger)?))
1266512666
} else {
12667+
log_info!(logger, "Waiting for peer reconnection to send stfu");
1266612668
Ok(None)
1266712669
}
1266812670
}

lightning/src/ln/channelmanager.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4675,14 +4675,6 @@ where
46754675
// Look for the channel
46764676
match peer_state.channel_by_id.entry(*channel_id) {
46774677
hash_map::Entry::Occupied(mut chan_phase_entry) => {
4678-
if !chan_phase_entry.get().context().is_connected() {
4679-
// TODO: We should probably support this, but right now `splice_channel` refuses when
4680-
// the peer is disconnected, so we just check it here.
4681-
return Err(APIError::ChannelUnavailable {
4682-
err: "Cannot initiate splice while peer is disconnected".to_owned(),
4683-
});
4684-
}
4685-
46864678
let locktime = locktime.unwrap_or_else(|| self.current_best_block().height);
46874679
if let Some(chan) = chan_phase_entry.get_mut().as_funded_mut() {
46884680
let logger = WithChannelContext::from(&self.logger, &chan.context, None);

0 commit comments

Comments
 (0)