@@ -6144,19 +6144,27 @@ impl<SP: Deref> Channel<SP> where
6144
6144
if let Some((fee, skip_remote_output, fee_range, holder_sig)) = self.context.last_sent_closing_fee.clone() {
6145
6145
debug_assert!(holder_sig.is_none());
6146
6146
log_trace!(logger, "Attempting to generate pending closing_signed...");
6147
- let (closing_tx, fee) = self.build_closing_transaction(fee, skip_remote_output)?;
6148
- let closing_signed = self.get_closing_signed_msg(&closing_tx, skip_remote_output,
6149
- fee, fee_range.min_fee_satoshis, fee_range.max_fee_satoshis, logger);
6150
- let signed_tx = if let (Some(ClosingSigned { signature, .. }), Some(counterparty_sig)) =
6151
- (closing_signed.as_ref(), self.context.last_received_closing_sig) {
6152
- let funding_redeemscript = self.context.get_funding_redeemscript();
6153
- let sighash = closing_tx.trust().get_sighash_all(&funding_redeemscript, self.context.channel_value_satoshis);
6154
- debug_assert!(self.context.secp_ctx.verify_ecdsa(&sighash, &counterparty_sig,
6155
- &self.context.get_counterparty_pubkeys().funding_pubkey).is_ok());
6156
- Some(self.build_signed_closing_transaction(&closing_tx, &counterparty_sig, signature))
6157
- } else { None };
6158
- let shutdown_result = signed_tx.as_ref().map(|_| self.shutdown_result_coop_close());
6159
- (closing_signed, signed_tx, shutdown_result)
6147
+ let closing_transaction_result = self.build_closing_transaction(fee, skip_remote_output);
6148
+ match closing_transaction_result {
6149
+ Ok((closing_tx, fee)) => {
6150
+ let closing_signed = self.get_closing_signed_msg(&closing_tx, skip_remote_output,
6151
+ fee, fee_range.min_fee_satoshis, fee_range.max_fee_satoshis, logger);
6152
+ let signed_tx = if let (Some(ClosingSigned { signature, .. }), Some(counterparty_sig)) =
6153
+ (closing_signed.as_ref(), self.context.last_received_closing_sig) {
6154
+ let funding_redeemscript = self.context.get_funding_redeemscript();
6155
+ let sighash = closing_tx.trust().get_sighash_all(&funding_redeemscript, self.context.channel_value_satoshis);
6156
+ debug_assert!(self.context.secp_ctx.verify_ecdsa(&sighash, &counterparty_sig,
6157
+ &self.context.get_counterparty_pubkeys().funding_pubkey).is_ok());
6158
+ Some(self.build_signed_closing_transaction(&closing_tx, &counterparty_sig, signature))
6159
+ } else { None };
6160
+ let shutdown_result = signed_tx.as_ref().map(|_| self.shutdown_result_coop_close());
6161
+ (closing_signed, signed_tx, shutdown_result)
6162
+ }
6163
+ Err(err) => {
6164
+ let shutdown = self.context.force_shutdown(true, ClosureReason::ProcessingError {err: err.to_string()});
6165
+ (None, None, Some(shutdown))
6166
+ }
6167
+ }
6160
6168
} else { (None, None, None) }
6161
6169
} else { (None, None, None) };
6162
6170
0 commit comments