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