@@ -5645,6 +5645,20 @@ impl<SP: Deref> FundedChannel<SP> where
5645
5645
5646
5646
let commitment_tx_info = self.context.validate_commitment_signed(&self.funding, &self.holder_commitment_point, msg, logger)?;
5647
5647
5648
+ if self.holder_commitment_point.advance(&self.context.holder_signer, &self.context.secp_ctx, logger).is_err() {
5649
+ // We only fail to advance our commitment point/number if we're currently
5650
+ // waiting for our signer to unblock and provide a commitment point.
5651
+ // During post-funding channel operation, we only advance our point upon
5652
+ // receiving a commitment_signed, and our counterparty cannot send us
5653
+ // another commitment signed until we've provided a new commitment point
5654
+ // in revoke_and_ack, which requires unblocking our signer and completing
5655
+ // the advance to the next point. This should be unreachable since
5656
+ // a new commitment_signed should fail at our signature checks in
5657
+ // validate_commitment_signed.
5658
+ debug_assert!(false, "We should be ready to advance our commitment point by the time we receive commitment_signed");
5659
+ return Err(ChannelError::close("Failed to advance our commitment point".to_owned()));
5660
+ }
5661
+
5648
5662
// Update state now that we've passed all the can-fail calls...
5649
5663
let mut need_commitment = false;
5650
5664
if let &mut Some((_, ref mut update_state)) = &mut self.context.pending_update_fee {
@@ -5700,18 +5714,6 @@ impl<SP: Deref> FundedChannel<SP> where
5700
5714
channel_id: Some(self.context.channel_id()),
5701
5715
};
5702
5716
5703
- if self.holder_commitment_point.advance(&self.context.holder_signer, &self.context.secp_ctx, logger).is_err() {
5704
- // We only fail to advance our commitment point/number if we're currently
5705
- // waiting for our signer to unblock and provide a commitment point.
5706
- // During post-funding channel operation, we only advance our point upon
5707
- // receiving a commitment_signed, and our counterparty cannot send us
5708
- // another commitment signed until we've provided a new commitment point
5709
- // in revoke_and_ack, which requires unblocking our signer and completing
5710
- // the advance to the next point. This should be unreachable since
5711
- // a new commitment_signed should fail at our signature checks above.
5712
- debug_assert!(false, "We should be ready to advance our commitment point by the time we receive commitment_signed");
5713
- return Err(ChannelError::close("Failed to advance our commitment point".to_owned()));
5714
- }
5715
5717
self.context.expecting_peer_commitment_signed = false;
5716
5718
// Note that if we need_commitment & !AwaitingRemoteRevoke we'll call
5717
5719
// build_commitment_no_status_check() next which will reset this to RAAFirst.
0 commit comments