Skip to content

Commit cb521b4

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 7152b54 commit cb521b4

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
@@ -5583,10 +5583,19 @@ where
55835583
SP::Target: SignerProvider,
55845584
L::Target: Logger,
55855585
{
5586+
let mut commitment_number = self.cur_counterparty_commitment_transaction_number;
5587+
let mut commitment_point = self.counterparty_cur_commitment_point.unwrap();
5588+
5589+
// Use the previous commitment number and point when splicing since they shouldn't change.
5590+
if commitment_number != INITIAL_COMMITMENT_NUMBER {
5591+
commitment_number += 1;
5592+
commitment_point = self.counterparty_prev_commitment_point.unwrap();
5593+
}
5594+
55865595
let commitment_data = self.build_commitment_transaction(
55875596
funding,
5588-
self.cur_counterparty_commitment_transaction_number,
5589-
&self.counterparty_cur_commitment_point.unwrap(),
5597+
commitment_number,
5598+
&commitment_point,
55905599
false,
55915600
false,
55925601
logger,
@@ -7019,8 +7028,8 @@ where
70197028
.context
70207029
.build_commitment_transaction(
70217030
pending_splice_funding,
7022-
self.context.cur_counterparty_commitment_transaction_number,
7023-
&self.context.counterparty_cur_commitment_point.unwrap(),
7031+
self.context.cur_counterparty_commitment_transaction_number + 1,
7032+
&self.context.counterparty_prev_commitment_point.unwrap(),
70247033
false,
70257034
false,
70267035
logger,

0 commit comments

Comments
 (0)