Skip to content

Commit 87db06a

Browse files
committed
Use correct commitment number/point in initial commitment_signed
When splicing a channel, the initial commitment_signed should use the same commitment number and point previously sent. Account for this by adjusting these to use the previous commitment number and point, since the next expected one is stored.
1 parent c8af714 commit 87db06a

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

lightning/src/ln/channel.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5590,10 +5590,19 @@ where
55905590
SP::Target: SignerProvider,
55915591
L::Target: Logger,
55925592
{
5593+
let mut commitment_number = self.cur_counterparty_commitment_transaction_number;
5594+
let mut commitment_point = self.counterparty_cur_commitment_point.unwrap();
5595+
5596+
// Use the previous commitment number and point when splicing since they shouldn't change.
5597+
if commitment_number != INITIAL_COMMITMENT_NUMBER {
5598+
commitment_number += 1;
5599+
commitment_point = self.counterparty_prev_commitment_point.unwrap();
5600+
}
5601+
55935602
let commitment_data = self.build_commitment_transaction(
55945603
funding,
5595-
self.cur_counterparty_commitment_transaction_number,
5596-
&self.counterparty_cur_commitment_point.unwrap(),
5604+
commitment_number,
5605+
&commitment_point,
55975606
false,
55985607
false,
55995608
logger,
@@ -7021,8 +7030,8 @@ where
70217030
.context
70227031
.build_commitment_transaction(
70237032
pending_splice_funding,
7024-
self.context.cur_counterparty_commitment_transaction_number,
7025-
&self.context.counterparty_cur_commitment_point.unwrap(),
7033+
self.context.cur_counterparty_commitment_transaction_number + 1,
7034+
&self.context.counterparty_prev_commitment_point.unwrap(),
70267035
false,
70277036
false,
70287037
logger,

0 commit comments

Comments
 (0)