@@ -5494,22 +5494,9 @@ impl<SP: Deref> FundedChannel<SP> where
54945494 Ok(channel_monitor)
54955495 }
54965496
5497- fn commitment_signed_check <L: Deref>(&self, msg: &msgs::CommitmentSigned, logger: &L) -> Result<LatestHolderCommitmentTXInfo, ChannelError>
5497+ fn validate_commitment_signed <L: Deref>(&self, msg: &msgs::CommitmentSigned, logger: &L) -> Result<LatestHolderCommitmentTXInfo, ChannelError>
54985498 where L::Target: Logger
54995499 {
5500- if self.context.channel_state.is_quiescent() {
5501- return Err(ChannelError::WarnAndDisconnect("Got commitment_signed message while quiescent".to_owned()));
5502- }
5503- if !matches!(self.context.channel_state, ChannelState::ChannelReady(_)) {
5504- return Err(ChannelError::close("Got commitment signed message when channel was not in an operational state".to_owned()));
5505- }
5506- if self.context.channel_state.is_peer_disconnected() {
5507- return Err(ChannelError::close("Peer sent commitment_signed when we needed a channel_reestablish".to_owned()));
5508- }
5509- if self.context.channel_state.is_both_sides_shutdown() && self.context.last_sent_closing_fee.is_some() {
5510- return Err(ChannelError::close("Peer sent commitment_signed after we'd started exchanging closing_signeds".to_owned()));
5511- }
5512-
55135500 let funding_script = self.funding.get_funding_redeemscript();
55145501
55155502 let keys = self.context.build_holder_transaction_keys(&self.funding, self.holder_commitment_point.current_point());
@@ -5632,7 +5619,20 @@ impl<SP: Deref> FundedChannel<SP> where
56325619 pub fn commitment_signed<L: Deref>(&mut self, msg: &msgs::CommitmentSigned, logger: &L) -> Result<Option<ChannelMonitorUpdate>, ChannelError>
56335620 where L::Target: Logger
56345621 {
5635- let commitment_tx_info = self.commitment_signed_check(msg, logger)?;
5622+ if self.context.channel_state.is_quiescent() {
5623+ return Err(ChannelError::WarnAndDisconnect("Got commitment_signed message while quiescent".to_owned()));
5624+ }
5625+ if !matches!(self.context.channel_state, ChannelState::ChannelReady(_)) {
5626+ return Err(ChannelError::close("Got commitment signed message when channel was not in an operational state".to_owned()));
5627+ }
5628+ if self.context.channel_state.is_peer_disconnected() {
5629+ return Err(ChannelError::close("Peer sent commitment_signed when we needed a channel_reestablish".to_owned()));
5630+ }
5631+ if self.context.channel_state.is_both_sides_shutdown() && self.context.last_sent_closing_fee.is_some() {
5632+ return Err(ChannelError::close("Peer sent commitment_signed after we'd started exchanging closing_signeds".to_owned()));
5633+ }
5634+
5635+ let commitment_tx_info = self.validate_commitment_signed(msg, logger)?;
56365636
56375637 // Update state now that we've passed all the can-fail calls...
56385638 let mut need_commitment = false;
0 commit comments