@@ -8735,7 +8735,7 @@ where
8735
8735
pub fn maybe_propose_closing_signed<F: Deref, L: Deref>(
8736
8736
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
8737
8737
) -> Result<
8738
- (Option<msgs::ClosingSigned>, Option<Transaction>, Option< ShutdownResult>),
8738
+ (Option<msgs::ClosingSigned>, Option<( Transaction, ShutdownResult) >),
8739
8739
ChannelError,
8740
8740
>
8741
8741
where
@@ -8747,20 +8747,20 @@ where
8747
8747
// initiate `closing_signed` negotiation until we're clear of all pending messages. Note
8748
8748
// that closing_negotiation_ready checks this case (as well as a few others).
8749
8749
if self.context.last_sent_closing_fee.is_some() || !self.closing_negotiation_ready() {
8750
- return Ok((None, None, None ));
8750
+ return Ok((None, None));
8751
8751
}
8752
8752
8753
8753
if !self.funding.is_outbound() {
8754
8754
if let Some(msg) = &self.context.pending_counterparty_closing_signed.take() {
8755
8755
return self.closing_signed(fee_estimator, &msg, logger);
8756
8756
}
8757
- return Ok((None, None, None ));
8757
+ return Ok((None, None));
8758
8758
}
8759
8759
8760
8760
// If we're waiting on a counterparty `commitment_signed` to clear some updates from our
8761
8761
// local commitment transaction, we can't yet initiate `closing_signed` negotiation.
8762
8762
if self.context.expecting_peer_commitment_signed {
8763
- return Ok((None, None, None ));
8763
+ return Ok((None, None));
8764
8764
}
8765
8765
8766
8766
let (our_min_fee, our_max_fee) = self.calculate_closing_fee_limits(fee_estimator);
@@ -8779,7 +8779,7 @@ where
8779
8779
our_max_fee,
8780
8780
logger,
8781
8781
);
8782
- Ok((closing_signed, None, None ))
8782
+ Ok((closing_signed, None))
8783
8783
}
8784
8784
8785
8785
fn mark_response_received(&mut self) {
@@ -9043,7 +9043,7 @@ where
9043
9043
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, msg: &msgs::ClosingSigned,
9044
9044
logger: &L,
9045
9045
) -> Result<
9046
- (Option<msgs::ClosingSigned>, Option<Transaction>, Option< ShutdownResult>),
9046
+ (Option<msgs::ClosingSigned>, Option<( Transaction, ShutdownResult) >),
9047
9047
ChannelError,
9048
9048
>
9049
9049
where
@@ -9085,7 +9085,7 @@ where
9085
9085
9086
9086
if self.context.channel_state.is_monitor_update_in_progress() {
9087
9087
self.context.pending_counterparty_closing_signed = Some(msg.clone());
9088
- return Ok((None, None, None ));
9088
+ return Ok((None, None));
9089
9089
}
9090
9090
9091
9091
let funding_redeemscript = self.funding.get_funding_redeemscript();
@@ -9139,7 +9139,7 @@ where
9139
9139
self.build_signed_closing_transaction(&mut closing_tx, &msg.signature, &sig);
9140
9140
self.context.channel_state = ChannelState::ShutdownComplete;
9141
9141
self.context.update_time_counter += 1;
9142
- return Ok((None, Some(tx), Some( shutdown_result)));
9142
+ return Ok((None, Some((tx, shutdown_result) )));
9143
9143
}
9144
9144
}
9145
9145
@@ -9162,26 +9162,25 @@ where
9162
9162
our_max_fee,
9163
9163
logger,
9164
9164
);
9165
- let (signed_tx, shutdown_result) = if $new_fee == msg.fee_satoshis {
9166
- let shutdown_result =
9167
- closing_signed.as_ref().map(|_| self.shutdown_result_coop_close());
9168
- if closing_signed.is_some() {
9169
- self.context.channel_state = ChannelState::ShutdownComplete;
9170
- }
9165
+ let signed_tx_shutdown = if $new_fee == msg.fee_satoshis {
9171
9166
self.context.update_time_counter += 1;
9172
9167
self.context.last_received_closing_sig = Some(msg.signature.clone());
9173
- let tx = closing_signed.as_ref().map(|ClosingSigned { signature, .. }| {
9174
- self.build_signed_closing_transaction(
9168
+ if let Some(ClosingSigned { signature, .. }) = &closing_signed {
9169
+ let shutdown_result = self.shutdown_result_coop_close();
9170
+ self.context.channel_state = ChannelState::ShutdownComplete;
9171
+ let tx = self.build_signed_closing_transaction(
9175
9172
&closing_tx,
9176
9173
&msg.signature,
9177
9174
signature,
9178
- )
9179
- });
9180
- (tx, shutdown_result)
9175
+ );
9176
+ Some((tx, shutdown_result))
9177
+ } else {
9178
+ None
9179
+ }
9181
9180
} else {
9182
- ( None, None)
9181
+ None
9183
9182
};
9184
- return Ok((closing_signed, signed_tx, shutdown_result ))
9183
+ return Ok((closing_signed, signed_tx_shutdown ))
9185
9184
};
9186
9185
}
9187
9186
0 commit comments