Skip to content

Commit d8f421e

Browse files
committed
Set funding_locked_txid TLVs in channel_reestablish
The previous commit extended the channel_reestablish message with your_last_funding_locked_txid and my_current_funding_locked_txid for use as described there. This commit sets those fields to the funding txid most recently sent/received accordingly.
1 parent 857432b commit d8f421e

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

lightning/src/ln/channel.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10962,6 +10962,22 @@ where
1096210962
}
1096310963
}
1096410964

10965+
#[cfg(splicing)]
10966+
fn maybe_get_my_current_funding_locked(&self) -> Option<msgs::FundingLocked> {
10967+
self.pending_splice
10968+
.as_ref()
10969+
.and_then(|pending_splice| pending_splice.sent_funding_txid)
10970+
.or_else(|| {
10971+
self.is_our_channel_ready().then(|| self.funding.get_funding_txid()).flatten()
10972+
})
10973+
.map(|txid| msgs::FundingLocked { txid, retransmit_flags: 0 })
10974+
}
10975+
10976+
#[cfg(not(splicing))]
10977+
fn maybe_get_my_current_funding_locked(&self) -> Option<msgs::FundingLocked> {
10978+
None
10979+
}
10980+
1096510981
/// May panic if called on a channel that wasn't immediately-previously
1096610982
/// self.remove_uncommitted_htlcs_and_mark_paused()'d
1096710983
#[rustfmt::skip]
@@ -11013,7 +11029,7 @@ where
1101311029
your_last_per_commitment_secret: remote_last_secret,
1101411030
my_current_per_commitment_point: dummy_pubkey,
1101511031
next_funding_txid: self.maybe_get_next_funding_txid(),
11016-
my_current_funding_locked: None,
11032+
my_current_funding_locked: self.maybe_get_my_current_funding_locked(),
1101711033
}
1101811034
}
1101911035

0 commit comments

Comments
 (0)