Skip to content

Commit 35b02cb

Browse files
committed
Avoid early return upon confirmation of channel funding
This early return is only possible if the channel requires a single confirmation, allowing a `channel_ready` message to go out. This can be problematic though if a commitment transaction (specifically from the counterparty, as the channel would be immediately closed if a local commitment is broadcast) also confirms within the same block. The `ChannelMonitor` will detect both, but it won't inform the `ChannelManager` at all. Luckily, while the channel still is considered open to the `ChannelManager`, the `ChannelMonitor` will reject any further updates to the channel state.
1 parent a10a906 commit 35b02cb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lightning/src/ln/channel.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4808,6 +4808,7 @@ impl<SP: Deref> Channel<SP> where
48084808
NS::Target: NodeSigner,
48094809
L::Target: Logger
48104810
{
4811+
let mut msgs = (None, None);
48114812
if let Some(funding_txo) = self.context.get_funding_txo() {
48124813
for &(index_in_block, tx) in txdata.iter() {
48134814
// Check if the transaction is the expected funding transaction, and if it is,
@@ -4863,7 +4864,7 @@ impl<SP: Deref> Channel<SP> where
48634864
if let Some(channel_ready) = self.check_get_channel_ready(height) {
48644865
log_info!(logger, "Sending a channel_ready to our peer for channel {}", &self.context.channel_id);
48654866
let announcement_sigs = self.get_announcement_sigs(node_signer, genesis_block_hash, user_config, height, logger);
4866-
return Ok((Some(channel_ready), announcement_sigs));
4867+
msgs = (Some(channel_ready), announcement_sigs);
48674868
}
48684869
}
48694870
for inp in tx.input.iter() {
@@ -4874,7 +4875,7 @@ impl<SP: Deref> Channel<SP> where
48744875
}
48754876
}
48764877
}
4877-
Ok((None, None))
4878+
Ok(msgs)
48784879
}
48794880

48804881
/// When a new block is connected, we check the height of the block against outbound holding

0 commit comments

Comments
 (0)