@@ -8643,7 +8643,7 @@ where
8643
8643
pub fn maybe_propose_closing_signed<F: Deref, L: Deref>(
8644
8644
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
8645
8645
) -> Result<
8646
- (Option<msgs::ClosingSigned>, Option<Transaction>, Option< ShutdownResult>),
8646
+ (Option<msgs::ClosingSigned>, Option<( Transaction, ShutdownResult) >),
8647
8647
ChannelError,
8648
8648
>
8649
8649
where
@@ -8655,20 +8655,20 @@ where
8655
8655
// initiate `closing_signed` negotiation until we're clear of all pending messages. Note
8656
8656
// that closing_negotiation_ready checks this case (as well as a few others).
8657
8657
if self.context.last_sent_closing_fee.is_some() || !self.closing_negotiation_ready() {
8658
- return Ok((None, None, None ));
8658
+ return Ok((None, None));
8659
8659
}
8660
8660
8661
8661
if !self.funding.is_outbound() {
8662
8662
if let Some(msg) = &self.context.pending_counterparty_closing_signed.take() {
8663
8663
return self.closing_signed(fee_estimator, &msg, logger);
8664
8664
}
8665
- return Ok((None, None, None ));
8665
+ return Ok((None, None));
8666
8666
}
8667
8667
8668
8668
// If we're waiting on a counterparty `commitment_signed` to clear some updates from our
8669
8669
// local commitment transaction, we can't yet initiate `closing_signed` negotiation.
8670
8670
if self.context.expecting_peer_commitment_signed {
8671
- return Ok((None, None, None ));
8671
+ return Ok((None, None));
8672
8672
}
8673
8673
8674
8674
let (our_min_fee, our_max_fee) = self.calculate_closing_fee_limits(fee_estimator);
@@ -8687,7 +8687,7 @@ where
8687
8687
our_max_fee,
8688
8688
logger,
8689
8689
);
8690
- Ok((closing_signed, None, None ))
8690
+ Ok((closing_signed, None))
8691
8691
}
8692
8692
8693
8693
fn mark_response_received(&mut self) {
@@ -8951,7 +8951,7 @@ where
8951
8951
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, msg: &msgs::ClosingSigned,
8952
8952
logger: &L,
8953
8953
) -> Result<
8954
- (Option<msgs::ClosingSigned>, Option<Transaction>, Option< ShutdownResult>),
8954
+ (Option<msgs::ClosingSigned>, Option<( Transaction, ShutdownResult) >),
8955
8955
ChannelError,
8956
8956
>
8957
8957
where
@@ -8993,7 +8993,7 @@ where
8993
8993
8994
8994
if self.context.channel_state.is_monitor_update_in_progress() {
8995
8995
self.context.pending_counterparty_closing_signed = Some(msg.clone());
8996
- return Ok((None, None, None ));
8996
+ return Ok((None, None));
8997
8997
}
8998
8998
8999
8999
let funding_redeemscript = self.funding.get_funding_redeemscript();
@@ -9047,7 +9047,7 @@ where
9047
9047
self.build_signed_closing_transaction(&mut closing_tx, &msg.signature, &sig);
9048
9048
self.context.channel_state = ChannelState::ShutdownComplete;
9049
9049
self.context.update_time_counter += 1;
9050
- return Ok((None, Some(tx), Some( shutdown_result)));
9050
+ return Ok((None, Some((tx, shutdown_result) )));
9051
9051
}
9052
9052
}
9053
9053
@@ -9070,26 +9070,25 @@ where
9070
9070
our_max_fee,
9071
9071
logger,
9072
9072
);
9073
- let (signed_tx, shutdown_result) = if $new_fee == msg.fee_satoshis {
9074
- let shutdown_result =
9075
- closing_signed.as_ref().map(|_| self.shutdown_result_coop_close());
9076
- if closing_signed.is_some() {
9077
- self.context.channel_state = ChannelState::ShutdownComplete;
9078
- }
9073
+ let signed_tx_shutdown = if $new_fee == msg.fee_satoshis {
9079
9074
self.context.update_time_counter += 1;
9080
9075
self.context.last_received_closing_sig = Some(msg.signature.clone());
9081
- let tx = closing_signed.as_ref().map(|ClosingSigned { signature, .. }| {
9082
- self.build_signed_closing_transaction(
9076
+ if let Some(ClosingSigned { signature, .. }) = &closing_signed {
9077
+ let shutdown_result = self.shutdown_result_coop_close();
9078
+ self.context.channel_state = ChannelState::ShutdownComplete;
9079
+ let tx = self.build_signed_closing_transaction(
9083
9080
&closing_tx,
9084
9081
&msg.signature,
9085
9082
signature,
9086
- )
9087
- });
9088
- (tx, shutdown_result)
9083
+ );
9084
+ Some((tx, shutdown_result))
9085
+ } else {
9086
+ None
9087
+ }
9089
9088
} else {
9090
- ( None, None)
9089
+ None
9091
9090
};
9092
- return Ok((closing_signed, signed_tx, shutdown_result ))
9091
+ return Ok((closing_signed, signed_tx_shutdown ))
9093
9092
};
9094
9093
}
9095
9094
0 commit comments