Skip to content

Commit 7836d6b

Browse files
committed
Handle cases where a channel is in use w/o an SCID in ChannelManager
In the next few commits we add support for 0conf channels, allowing us to have an active channel with HTLC and other updates flying prior to having an SCID available. This would break several assumptions made in `ChannelManager`, which we address here by looking at SCID aliases in addition to SCIDs.
1 parent af31831 commit 7836d6b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ macro_rules! handle_chan_restoration_locked {
16431643
let res = loop {
16441644
let forwards: Vec<(PendingHTLCInfo, u64)> = $pending_forwards; // Force type-checking to resolve
16451645
if !forwards.is_empty() {
1646-
htlc_forwards = Some(($channel_entry.get().get_short_channel_id().expect("We can't have pending forwards before funding confirmation"),
1646+
htlc_forwards = Some(($channel_entry.get().get_short_channel_id().unwrap_or($channel_entry.get().outbound_scid_alias()),
16471647
$channel_entry.get().get_funding_txo().unwrap(), forwards));
16481648
}
16491649

@@ -4908,7 +4908,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
49084908
break Ok((raa_updates.accepted_htlcs, raa_updates.failed_htlcs,
49094909
raa_updates.finalized_claimed_htlcs,
49104910
chan.get().get_short_channel_id()
4911-
.expect("RAA should only work on a short-id-available channel"),
4911+
.unwrap_or(chan.get().outbound_scid_alias()),
49124912
chan.get().get_funding_txo().unwrap()))
49134913
},
49144914
hash_map::Entry::Vacant(_) => break Err(MsgHandleErrInternal::send_err_msg_no_close("Failed to find corresponding channel".to_owned(), msg.channel_id))

0 commit comments

Comments
 (0)