@@ -5494,22 +5494,9 @@ impl<SP: Deref> FundedChannel<SP> where
5494
5494
Ok(channel_monitor)
5495
5495
}
5496
5496
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>
5498
5498
where L::Target: Logger
5499
5499
{
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
-
5513
5500
let funding_script = self.funding.get_funding_redeemscript();
5514
5501
5515
5502
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
5632
5619
pub fn commitment_signed<L: Deref>(&mut self, msg: &msgs::CommitmentSigned, logger: &L) -> Result<Option<ChannelMonitorUpdate>, ChannelError>
5633
5620
where L::Target: Logger
5634
5621
{
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)?;
5636
5636
5637
5637
// Update state now that we've passed all the can-fail calls...
5638
5638
let mut need_commitment = false;
0 commit comments