@@ -8787,10 +8787,7 @@ where
8787
8787
8788
8788
pub fn maybe_propose_closing_signed<F: Deref, L: Deref>(
8789
8789
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
8790
- ) -> Result<
8791
- (Option<msgs::ClosingSigned>, Option<Transaction>, Option<ShutdownResult>),
8792
- ChannelError,
8793
- >
8790
+ ) -> Result<(Option<msgs::ClosingSigned>, Option<(Transaction, ShutdownResult)>), ChannelError>
8794
8791
where
8795
8792
F::Target: FeeEstimator,
8796
8793
L::Target: Logger,
@@ -8800,20 +8797,20 @@ where
8800
8797
// initiate `closing_signed` negotiation until we're clear of all pending messages. Note
8801
8798
// that closing_negotiation_ready checks this case (as well as a few others).
8802
8799
if self.context.last_sent_closing_fee.is_some() || !self.closing_negotiation_ready() {
8803
- return Ok((None, None, None ));
8800
+ return Ok((None, None));
8804
8801
}
8805
8802
8806
8803
if !self.funding.is_outbound() {
8807
8804
if let Some(msg) = &self.context.pending_counterparty_closing_signed.take() {
8808
8805
return self.closing_signed(fee_estimator, &msg, logger);
8809
8806
}
8810
- return Ok((None, None, None ));
8807
+ return Ok((None, None));
8811
8808
}
8812
8809
8813
8810
// If we're waiting on a counterparty `commitment_signed` to clear some updates from our
8814
8811
// local commitment transaction, we can't yet initiate `closing_signed` negotiation.
8815
8812
if self.context.expecting_peer_commitment_signed {
8816
- return Ok((None, None, None ));
8813
+ return Ok((None, None));
8817
8814
}
8818
8815
8819
8816
let (our_min_fee, our_max_fee) = self.calculate_closing_fee_limits(fee_estimator);
@@ -8832,7 +8829,7 @@ where
8832
8829
our_max_fee,
8833
8830
logger,
8834
8831
);
8835
- Ok((closing_signed, None, None ))
8832
+ Ok((closing_signed, None))
8836
8833
}
8837
8834
8838
8835
fn mark_response_received(&mut self) {
@@ -9095,10 +9092,7 @@ where
9095
9092
pub fn closing_signed<F: Deref, L: Deref>(
9096
9093
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, msg: &msgs::ClosingSigned,
9097
9094
logger: &L,
9098
- ) -> Result<
9099
- (Option<msgs::ClosingSigned>, Option<Transaction>, Option<ShutdownResult>),
9100
- ChannelError,
9101
- >
9095
+ ) -> Result<(Option<msgs::ClosingSigned>, Option<(Transaction, ShutdownResult)>), ChannelError>
9102
9096
where
9103
9097
F::Target: FeeEstimator,
9104
9098
L::Target: Logger,
@@ -9138,7 +9132,7 @@ where
9138
9132
9139
9133
if self.context.channel_state.is_monitor_update_in_progress() {
9140
9134
self.context.pending_counterparty_closing_signed = Some(msg.clone());
9141
- return Ok((None, None, None ));
9135
+ return Ok((None, None));
9142
9136
}
9143
9137
9144
9138
let funding_redeemscript = self.funding.get_funding_redeemscript();
@@ -9192,7 +9186,7 @@ where
9192
9186
self.build_signed_closing_transaction(&mut closing_tx, &msg.signature, &sig);
9193
9187
self.context.channel_state = ChannelState::ShutdownComplete;
9194
9188
self.context.update_time_counter += 1;
9195
- return Ok((None, Some(tx), Some( shutdown_result)));
9189
+ return Ok((None, Some((tx, shutdown_result) )));
9196
9190
}
9197
9191
}
9198
9192
@@ -9215,26 +9209,25 @@ where
9215
9209
our_max_fee,
9216
9210
logger,
9217
9211
);
9218
- let (signed_tx, shutdown_result) = if $new_fee == msg.fee_satoshis {
9219
- let shutdown_result =
9220
- closing_signed.as_ref().map(|_| self.shutdown_result_coop_close());
9221
- if closing_signed.is_some() {
9222
- self.context.channel_state = ChannelState::ShutdownComplete;
9223
- }
9212
+ let signed_tx_shutdown = if $new_fee == msg.fee_satoshis {
9224
9213
self.context.update_time_counter += 1;
9225
9214
self.context.last_received_closing_sig = Some(msg.signature.clone());
9226
- let tx = closing_signed.as_ref().map(|ClosingSigned { signature, .. }| {
9227
- self.build_signed_closing_transaction(
9215
+ if let Some(ClosingSigned { signature, .. }) = &closing_signed {
9216
+ let shutdown_result = self.shutdown_result_coop_close();
9217
+ self.context.channel_state = ChannelState::ShutdownComplete;
9218
+ let tx = self.build_signed_closing_transaction(
9228
9219
&closing_tx,
9229
9220
&msg.signature,
9230
9221
signature,
9231
- )
9232
- });
9233
- (tx, shutdown_result)
9222
+ );
9223
+ Some((tx, shutdown_result))
9224
+ } else {
9225
+ None
9226
+ }
9234
9227
} else {
9235
- ( None, None)
9228
+ None
9236
9229
};
9237
- return Ok((closing_signed, signed_tx, shutdown_result ))
9230
+ return Ok((closing_signed, signed_tx_shutdown ))
9238
9231
};
9239
9232
}
9240
9233
0 commit comments