Skip to content

Commit 7ab1580

Browse files
jkczyzAnyitechs
authored andcommitted
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 02c9d0f commit 7ab1580

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
@@ -10998,6 +10998,22 @@ where
1099810998
}
1099910999
}
1100011000

11001+
#[cfg(splicing)]
11002+
fn maybe_get_my_current_funding_locked(&self) -> Option<msgs::FundingLocked> {
11003+
self.pending_splice
11004+
.as_ref()
11005+
.and_then(|pending_splice| pending_splice.sent_funding_txid)
11006+
.or_else(|| {
11007+
self.is_our_channel_ready().then(|| self.funding.get_funding_txid()).flatten()
11008+
})
11009+
.map(|txid| msgs::FundingLocked { txid, retransmit_flags: 0 })
11010+
}
11011+
11012+
#[cfg(not(splicing))]
11013+
fn maybe_get_my_current_funding_locked(&self) -> Option<msgs::FundingLocked> {
11014+
None
11015+
}
11016+
1100111017
/// May panic if called on a channel that wasn't immediately-previously
1100211018
/// self.remove_uncommitted_htlcs_and_mark_paused()'d
1100311019
#[rustfmt::skip]
@@ -11049,7 +11065,7 @@ where
1104911065
your_last_per_commitment_secret: remote_last_secret,
1105011066
my_current_per_commitment_point: dummy_pubkey,
1105111067
next_funding_txid: self.maybe_get_next_funding_txid(),
11052-
my_current_funding_locked: None,
11068+
my_current_funding_locked: self.maybe_get_my_current_funding_locked(),
1105311069
}
1105411070
}
1105511071

0 commit comments

Comments
 (0)