Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions lightning/src/ln/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10714,6 +10714,9 @@ where
let required_revoke = if msg.next_remote_commitment_number == our_commitment_transaction {
// Remote isn't waiting on any RevokeAndACK from us!
// Note that if we need to repeat our ChannelReady we'll do that in the next if block.
// If a stale ChannelManager replayed a completed update, the monitor-pending state may
// still think we owe one; the reestablish proof is authoritative here.
self.context.monitor_pending_revoke_and_ack = false;
None
} else if msg.next_remote_commitment_number + 1 == our_commitment_transaction {
if self.context.channel_state.is_monitor_update_in_progress() {
Expand Down Expand Up @@ -10784,9 +10787,25 @@ where
channel_id: self.context.channel_id,
splice_txid,
})
}).or_else(|| {
// If a splice confirms after we've sent `channel_reestablish` but before we've received
// theirs, we may promote the splice and clear `pending_splice`. We still need to send
// `splice_locked` after reestablishing as it was not included in our
// `channel_reestablish`.
let current_funding_txid = self.funding.get_funding_txid()?;
(self.pending_splice.is_none()
&& self.funding.channel_transaction_parameters.splice_parent_funding_txid.is_some()
&& Some(current_funding_txid) != funding_locked_txid_sent_in_reestablish)
.then(|| msgs::SpliceLocked {
channel_id: self.context.channel_id,
splice_txid: current_funding_txid,
})
});
Comment thread
wpaulino marked this conversation as resolved.

if msg.next_local_commitment_number == next_counterparty_commitment_number {
// If a stale ChannelManager replayed a completed update, the monitor-pending state may
// still think we owe one.
self.context.monitor_pending_commitment_signed = false;
if required_revoke.is_some() || self.context.signer_pending_revoke_and_ack {
log_debug!(logger, "Reconnected with only lost outbound RAA");
} else {
Expand Down
26 changes: 13 additions & 13 deletions lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11052,6 +11052,19 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
}
}

if let Some(funding_tx_signed) = funding_tx_signed.as_ref() {
// These [`FundingTxSigned`] fields are only expected as a result of calling
// [`ChannelManager::funding_transaction_signed`].
debug_assert!(funding_tx_signed.commitment_signed.is_none());
debug_assert!(funding_tx_signed.counterparty_initial_commitment_signed_result.is_none());
}
if let Some(msg) = funding_tx_signed.as_mut().and_then(|v| v.splice_locked.take()) {
pending_msg_events.push(MessageSendEvent::SendSpliceLocked {
node_id: counterparty_node_id,
msg,
});
}

macro_rules! handle_cs { () => {
if let Some(update) = commitment_update {
pending_msg_events.push(MessageSendEvent::UpdateHTLCs {
Expand Down Expand Up @@ -11080,12 +11093,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
},
}

if let Some(funding_tx_signed) = funding_tx_signed.as_ref() {
// These [`FundingTxSigned`] fields are only expected as a result of calling
// [`ChannelManager::funding_transaction_signed`].
debug_assert!(funding_tx_signed.commitment_signed.is_none());
debug_assert!(funding_tx_signed.counterparty_initial_commitment_signed_result.is_none());
}
if let Some(msg) = funding_tx_signed.as_mut().and_then(|v| v.tx_signatures.take()) {
pending_msg_events.push(MessageSendEvent::SendTxSignatures {
node_id: counterparty_node_id,
Expand All @@ -11111,13 +11118,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
});
}
}

if let Some(msg) = funding_tx_signed.as_mut().and_then(|v| v.splice_locked.take()) {
pending_msg_events.push(MessageSendEvent::SendSpliceLocked {
node_id: counterparty_node_id,
msg,
});
}
} else if let Some(msg) = channel_ready {
self.send_channel_ready(pending_msg_events, channel, msg);
}
Expand Down
2 changes: 1 addition & 1 deletion lightning/src/ln/functional_test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ pub fn get_updates_and_revoke<CM: AChannelManager, H: NodeHolder<CM = CM>>(
macro_rules! get_event_msg {
($node: expr, $event_type: path, $node_id: expr) => {{
let events = $node.node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
assert_eq!(events.len(), 1, "{events:?}");
match events[0] {
$event_type { ref node_id, ref msg } => {
assert_eq!(*node_id, $node_id);
Expand Down
Loading