@@ -8835,10 +8835,7 @@ where
8835
8835
8836
8836
pub fn maybe_propose_closing_signed<F: Deref, L: Deref>(
8837
8837
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
8838
- ) -> Result<
8839
- (Option<msgs::ClosingSigned>, Option<Transaction>, Option<ShutdownResult>),
8840
- ChannelError,
8841
- >
8838
+ ) -> Result<(Option<msgs::ClosingSigned>, Option<(Transaction, ShutdownResult)>), ChannelError>
8842
8839
where
8843
8840
F::Target: FeeEstimator,
8844
8841
L::Target: Logger,
@@ -8848,20 +8845,20 @@ where
8848
8845
// initiate `closing_signed` negotiation until we're clear of all pending messages. Note
8849
8846
// that closing_negotiation_ready checks this case (as well as a few others).
8850
8847
if self.context.last_sent_closing_fee.is_some() || !self.closing_negotiation_ready() {
8851
- return Ok((None, None, None ));
8848
+ return Ok((None, None));
8852
8849
}
8853
8850
8854
8851
if !self.funding.is_outbound() {
8855
8852
if let Some(msg) = &self.context.pending_counterparty_closing_signed.take() {
8856
8853
return self.closing_signed(fee_estimator, &msg, logger);
8857
8854
}
8858
- return Ok((None, None, None ));
8855
+ return Ok((None, None));
8859
8856
}
8860
8857
8861
8858
// If we're waiting on a counterparty `commitment_signed` to clear some updates from our
8862
8859
// local commitment transaction, we can't yet initiate `closing_signed` negotiation.
8863
8860
if self.context.expecting_peer_commitment_signed {
8864
- return Ok((None, None, None ));
8861
+ return Ok((None, None));
8865
8862
}
8866
8863
8867
8864
let (our_min_fee, our_max_fee) = self.calculate_closing_fee_limits(fee_estimator);
@@ -8880,7 +8877,7 @@ where
8880
8877
our_max_fee,
8881
8878
logger,
8882
8879
);
8883
- Ok((closing_signed, None, None ))
8880
+ Ok((closing_signed, None))
8884
8881
}
8885
8882
8886
8883
fn mark_response_received(&mut self) {
@@ -9143,10 +9140,7 @@ where
9143
9140
pub fn closing_signed<F: Deref, L: Deref>(
9144
9141
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, msg: &msgs::ClosingSigned,
9145
9142
logger: &L,
9146
- ) -> Result<
9147
- (Option<msgs::ClosingSigned>, Option<Transaction>, Option<ShutdownResult>),
9148
- ChannelError,
9149
- >
9143
+ ) -> Result<(Option<msgs::ClosingSigned>, Option<(Transaction, ShutdownResult)>), ChannelError>
9150
9144
where
9151
9145
F::Target: FeeEstimator,
9152
9146
L::Target: Logger,
@@ -9186,7 +9180,7 @@ where
9186
9180
9187
9181
if self.context.channel_state.is_monitor_update_in_progress() {
9188
9182
self.context.pending_counterparty_closing_signed = Some(msg.clone());
9189
- return Ok((None, None, None ));
9183
+ return Ok((None, None));
9190
9184
}
9191
9185
9192
9186
let funding_redeemscript = self.funding.get_funding_redeemscript();
@@ -9240,7 +9234,7 @@ where
9240
9234
self.build_signed_closing_transaction(&mut closing_tx, &msg.signature, &sig);
9241
9235
self.context.channel_state = ChannelState::ShutdownComplete;
9242
9236
self.context.update_time_counter += 1;
9243
- return Ok((None, Some(tx), Some( shutdown_result)));
9237
+ return Ok((None, Some((tx, shutdown_result) )));
9244
9238
}
9245
9239
}
9246
9240
@@ -9263,26 +9257,25 @@ where
9263
9257
our_max_fee,
9264
9258
logger,
9265
9259
);
9266
- let (signed_tx, shutdown_result) = if $new_fee == msg.fee_satoshis {
9267
- let shutdown_result =
9268
- closing_signed.as_ref().map(|_| self.shutdown_result_coop_close());
9269
- if closing_signed.is_some() {
9270
- self.context.channel_state = ChannelState::ShutdownComplete;
9271
- }
9260
+ let signed_tx_shutdown = if $new_fee == msg.fee_satoshis {
9272
9261
self.context.update_time_counter += 1;
9273
9262
self.context.last_received_closing_sig = Some(msg.signature.clone());
9274
- let tx = closing_signed.as_ref().map(|ClosingSigned { signature, .. }| {
9275
- self.build_signed_closing_transaction(
9263
+ if let Some(ClosingSigned { signature, .. }) = &closing_signed {
9264
+ let shutdown_result = self.shutdown_result_coop_close();
9265
+ self.context.channel_state = ChannelState::ShutdownComplete;
9266
+ let tx = self.build_signed_closing_transaction(
9276
9267
&closing_tx,
9277
9268
&msg.signature,
9278
9269
signature,
9279
- )
9280
- });
9281
- (tx, shutdown_result)
9270
+ );
9271
+ Some((tx, shutdown_result))
9272
+ } else {
9273
+ None
9274
+ }
9282
9275
} else {
9283
- ( None, None)
9276
+ None
9284
9277
};
9285
- return Ok((closing_signed, signed_tx, shutdown_result ))
9278
+ return Ok((closing_signed, signed_tx_shutdown ))
9286
9279
};
9287
9280
}
9288
9281
0 commit comments