@@ -5638,6 +5638,20 @@ impl<SP: Deref> FundedChannel<SP> where
56385638
56395639 let commitment_tx_info = self.context.validate_commitment_signed(&self.funding, &self.holder_commitment_point, msg, logger)?;
56405640
5641+ if self.holder_commitment_point.advance(&self.context.holder_signer, &self.context.secp_ctx, logger).is_err() {
5642+ // We only fail to advance our commitment point/number if we're currently
5643+ // waiting for our signer to unblock and provide a commitment point.
5644+ // During post-funding channel operation, we only advance our point upon
5645+ // receiving a commitment_signed, and our counterparty cannot send us
5646+ // another commitment signed until we've provided a new commitment point
5647+ // in revoke_and_ack, which requires unblocking our signer and completing
5648+ // the advance to the next point. This should be unreachable since
5649+ // a new commitment_signed should fail at our signature checks in
5650+ // validate_commitment_signed.
5651+ debug_assert!(false, "We should be ready to advance our commitment point by the time we receive commitment_signed");
5652+ return Err(ChannelError::close("Failed to advance our commitment point".to_owned()));
5653+ }
5654+
56415655 // Update state now that we've passed all the can-fail calls...
56425656 let mut need_commitment = false;
56435657 if let &mut Some((_, ref mut update_state)) = &mut self.context.pending_update_fee {
@@ -5693,18 +5707,6 @@ impl<SP: Deref> FundedChannel<SP> where
56935707 channel_id: Some(self.context.channel_id()),
56945708 };
56955709
5696- if self.holder_commitment_point.advance(&self.context.holder_signer, &self.context.secp_ctx, logger).is_err() {
5697- // We only fail to advance our commitment point/number if we're currently
5698- // waiting for our signer to unblock and provide a commitment point.
5699- // During post-funding channel operation, we only advance our point upon
5700- // receiving a commitment_signed, and our counterparty cannot send us
5701- // another commitment signed until we've provided a new commitment point
5702- // in revoke_and_ack, which requires unblocking our signer and completing
5703- // the advance to the next point. This should be unreachable since
5704- // a new commitment_signed should fail at our signature checks above.
5705- debug_assert!(false, "We should be ready to advance our commitment point by the time we receive commitment_signed");
5706- return Err(ChannelError::close("Failed to advance our commitment point".to_owned()));
5707- }
57085710 self.context.expecting_peer_commitment_signed = false;
57095711 // Note that if we need_commitment & !AwaitingRemoteRevoke we'll call
57105712 // build_commitment_no_status_check() next which will reset this to RAAFirst.
0 commit comments