Skip to content

Commit 9ea70be

Browse files
committed
Don't set sent_funding_txid in maybe_promote_splice_funding
When sending splice_locked, set PendingSplice::sent_funding_txid prior to calling FundedChannel::maybe_promote_splice_funding. This makes the latter idempotent when the splice is not promoted. Otherwise, successive calls could override the previously set sent_funding_txid.
1 parent b5bfa85 commit 9ea70be

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lightning/src/ln/channel.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9134,8 +9134,6 @@ where
91349134
debug_assert!(confirmed_funding_index < self.pending_funding.len());
91359135

91369136
let pending_splice = self.pending_splice.as_mut().unwrap();
9137-
pending_splice.sent_funding_txid = Some(splice_txid);
9138-
91399137
if pending_splice.sent_funding_txid == pending_splice.received_funding_txid {
91409138
log_info!(
91419139
logger,
@@ -9252,6 +9250,9 @@ where
92529250
}
92539251
}
92549252

9253+
let pending_splice = self.pending_splice.as_mut().unwrap();
9254+
pending_splice.sent_funding_txid = Some(splice_locked.splice_txid);
9255+
92559256
log_info!(
92569257
logger,
92579258
"Sending splice_locked txid {} to our peer for channel {}",
@@ -9420,6 +9421,9 @@ where
94209421
let pending_splice = self.pending_splice.as_ref().unwrap();
94219422
let funding = self.pending_funding.get(confirmed_funding_index).unwrap();
94229423
if let Some(splice_locked) = self.check_get_splice_locked(pending_splice, funding, height) {
9424+
let pending_splice = self.pending_splice.as_mut().unwrap();
9425+
pending_splice.sent_funding_txid = Some(splice_locked.splice_txid);
9426+
94239427
log_info!(logger, "Sending a splice_locked to our peer for channel {}", &self.context.channel_id);
94249428

94259429
let announcement_sigs = self

0 commit comments

Comments
 (0)