@@ -9366,6 +9366,10 @@ where
9366
9366
return Err(ChannelError::close("Peer sent a loose channel_reestablish not after reconnect".to_owned()));
9367
9367
}
9368
9368
9369
+ // A node:
9370
+ // - if `next_commitment_number` is zero:
9371
+ // - MUST immediately fail the channel and broadcast any relevant latest commitment
9372
+ // transaction.
9369
9373
if msg.next_local_commitment_number == 0
9370
9374
|| msg.next_local_commitment_number >= INITIAL_COMMITMENT_NUMBER
9371
9375
|| msg.next_remote_commitment_number >= INITIAL_COMMITMENT_NUMBER
@@ -9437,9 +9441,10 @@ where
9437
9441
let mut tx_signatures = None;
9438
9442
let mut tx_abort = None;
9439
9443
9440
- // if next_funding is set:
9444
+ // A receiving node:
9445
+ // - if the `next_funding` TLV is set:
9441
9446
if let Some(next_funding) = &msg.next_funding {
9442
- // - if `next_funding ` matches the latest interactive funding transaction
9447
+ // - if `next_funding_txid ` matches the latest interactive funding transaction
9443
9448
// or the current channel funding transaction:
9444
9449
if let Some(session) = &self.context.interactive_tx_signing_session {
9445
9450
let our_next_funding_txid = session.unsigned_tx().compute_txid();
@@ -9454,8 +9459,12 @@ where
9454
9459
self.context.expecting_peer_commitment_signed = true;
9455
9460
}
9456
9461
9457
- // TODO(splicing): Add comment for spec requirements
9458
- if next_funding.should_retransmit(msgs::NextFundingFlag::CommitmentSigned) {
9462
+ // - if it has not received `tx_signatures` for that funding transaction:
9463
+ // - if the `commitment_signed` bit is set in `retransmit_flags`:
9464
+ if !session.has_received_tx_signatures()
9465
+ && next_funding.should_retransmit(msgs::NextFundingFlag::CommitmentSigned)
9466
+ {
9467
+ // - MUST retransmit its `commitment_signed` for that funding transaction.
9459
9468
let funding = self
9460
9469
.pending_splice
9461
9470
.as_ref()
@@ -9591,6 +9600,13 @@ where
9591
9600
let is_awaiting_remote_revoke = self.context.channel_state.is_awaiting_remote_revoke();
9592
9601
let next_counterparty_commitment_number = INITIAL_COMMITMENT_NUMBER - self.context.counterparty_next_commitment_transaction_number + if is_awaiting_remote_revoke { 1 } else { 0 };
9593
9602
9603
+ // A node:
9604
+ // - if `next_commitment_number` is 1 in both the `channel_reestablish` it
9605
+ // sent and received:
9606
+ // - MUST retransmit `channel_ready`.
9607
+ // - otherwise:
9608
+ // - MUST NOT retransmit `channel_ready`, but MAY send `channel_ready` with
9609
+ // a different `short_channel_id` `alias` field.
9594
9610
let channel_ready = if msg.next_local_commitment_number == 1 && INITIAL_COMMITMENT_NUMBER - self.holder_commitment_point.next_transaction_number() == 1 {
9595
9611
// We should never have to worry about MonitorUpdateInProgress resending ChannelReady
9596
9612
self.get_channel_ready(logger)
@@ -11293,26 +11309,31 @@ where
11293
11309
}
11294
11310
11295
11311
fn maybe_get_next_funding(&self) -> Option<msgs::NextFunding> {
11296
- // If we've sent `commtiment_signed` for an interactively constructed transaction
11297
- // during a signing session, but have not received `tx_signatures` we MUST set `next_funding`
11298
- // to the txid of that interactive transaction, else we MUST NOT set it.
11312
+ // The sending node:
11313
+ // - if it has sent `commitment_signed` for an interactive transaction construction but
11314
+ // it has not received `tx_signatures`:
11299
11315
self.context
11300
11316
.interactive_tx_signing_session
11301
11317
.as_ref()
11302
11318
.filter(|session| !session.has_received_tx_signatures())
11303
11319
.map(|signing_session| {
11320
+ // - MUST include the `next_funding` TLV.
11321
+ // - MUST set `next_funding_txid` to the txid of that interactive transaction.
11304
11322
let mut next_funding = msgs::NextFunding {
11305
11323
txid: signing_session.unsigned_tx().compute_txid(),
11306
11324
retransmit_flags: 0,
11307
11325
};
11308
11326
11309
- // TODO(splicing): Add comment for spec requirements
11327
+ // - if it has not received `commitment_signed` for this `next_funding_txid`:
11328
+ // - MUST set the `commitment_signed` bit in `retransmit_flags`.
11310
11329
if !signing_session.has_received_commitment_signed() {
11311
11330
next_funding.retransmit(msgs::NextFundingFlag::CommitmentSigned);
11312
11331
}
11313
11332
11314
11333
next_funding
11315
11334
})
11335
+ // - otherwise:
11336
+ // - MUST NOT include the `next_funding` TLV.
11316
11337
}
11317
11338
11318
11339
fn maybe_get_my_current_funding_locked(&self) -> Option<msgs::FundingLocked> {
0 commit comments