@@ -8500,7 +8500,7 @@ where
8500
8500
pub fn maybe_propose_closing_signed<F: Deref, L: Deref>(
8501
8501
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
8502
8502
) -> Result<
8503
- (Option<msgs::ClosingSigned>, Option<Transaction>, Option< ShutdownResult>),
8503
+ (Option<msgs::ClosingSigned>, Option<( Transaction, ShutdownResult) >),
8504
8504
ChannelError,
8505
8505
>
8506
8506
where
@@ -8512,20 +8512,20 @@ where
8512
8512
// initiate `closing_signed` negotiation until we're clear of all pending messages. Note
8513
8513
// that closing_negotiation_ready checks this case (as well as a few others).
8514
8514
if self.context.last_sent_closing_fee.is_some() || !self.closing_negotiation_ready() {
8515
- return Ok((None, None, None ));
8515
+ return Ok((None, None));
8516
8516
}
8517
8517
8518
8518
if !self.funding.is_outbound() {
8519
8519
if let Some(msg) = &self.context.pending_counterparty_closing_signed.take() {
8520
8520
return self.closing_signed(fee_estimator, &msg, logger);
8521
8521
}
8522
- return Ok((None, None, None ));
8522
+ return Ok((None, None));
8523
8523
}
8524
8524
8525
8525
// If we're waiting on a counterparty `commitment_signed` to clear some updates from our
8526
8526
// local commitment transaction, we can't yet initiate `closing_signed` negotiation.
8527
8527
if self.context.expecting_peer_commitment_signed {
8528
- return Ok((None, None, None ));
8528
+ return Ok((None, None));
8529
8529
}
8530
8530
8531
8531
let (our_min_fee, our_max_fee) = self.calculate_closing_fee_limits(fee_estimator);
@@ -8544,7 +8544,7 @@ where
8544
8544
our_max_fee,
8545
8545
logger,
8546
8546
);
8547
- Ok((closing_signed, None, None ))
8547
+ Ok((closing_signed, None))
8548
8548
}
8549
8549
8550
8550
fn mark_response_received(&mut self) {
@@ -8808,7 +8808,7 @@ where
8808
8808
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, msg: &msgs::ClosingSigned,
8809
8809
logger: &L,
8810
8810
) -> Result<
8811
- (Option<msgs::ClosingSigned>, Option<Transaction>, Option< ShutdownResult>),
8811
+ (Option<msgs::ClosingSigned>, Option<( Transaction, ShutdownResult) >),
8812
8812
ChannelError,
8813
8813
>
8814
8814
where
@@ -8850,7 +8850,7 @@ where
8850
8850
8851
8851
if self.context.channel_state.is_monitor_update_in_progress() {
8852
8852
self.context.pending_counterparty_closing_signed = Some(msg.clone());
8853
- return Ok((None, None, None ));
8853
+ return Ok((None, None));
8854
8854
}
8855
8855
8856
8856
let funding_redeemscript = self.funding.get_funding_redeemscript();
@@ -8904,7 +8904,7 @@ where
8904
8904
self.build_signed_closing_transaction(&mut closing_tx, &msg.signature, &sig);
8905
8905
self.context.channel_state = ChannelState::ShutdownComplete;
8906
8906
self.context.update_time_counter += 1;
8907
- return Ok((None, Some(tx), Some( shutdown_result)));
8907
+ return Ok((None, Some((tx, shutdown_result) )));
8908
8908
}
8909
8909
}
8910
8910
@@ -8927,26 +8927,25 @@ where
8927
8927
our_max_fee,
8928
8928
logger,
8929
8929
);
8930
- let (signed_tx, shutdown_result) = if $new_fee == msg.fee_satoshis {
8931
- let shutdown_result =
8932
- closing_signed.as_ref().map(|_| self.shutdown_result_coop_close());
8933
- if closing_signed.is_some() {
8934
- self.context.channel_state = ChannelState::ShutdownComplete;
8935
- }
8930
+ let signed_tx_shutdown = if $new_fee == msg.fee_satoshis {
8936
8931
self.context.update_time_counter += 1;
8937
8932
self.context.last_received_closing_sig = Some(msg.signature.clone());
8938
- let tx = closing_signed.as_ref().map(|ClosingSigned { signature, .. }| {
8939
- self.build_signed_closing_transaction(
8933
+ if let Some(ClosingSigned { signature, .. }) = &closing_signed {
8934
+ let shutdown_result = self.shutdown_result_coop_close();
8935
+ self.context.channel_state = ChannelState::ShutdownComplete;
8936
+ let tx = self.build_signed_closing_transaction(
8940
8937
&closing_tx,
8941
8938
&msg.signature,
8942
8939
signature,
8943
- )
8944
- });
8945
- (tx, shutdown_result)
8940
+ );
8941
+ Some((tx, shutdown_result))
8942
+ } else {
8943
+ None
8944
+ }
8946
8945
} else {
8947
- ( None, None)
8946
+ None
8948
8947
};
8949
- return Ok((closing_signed, signed_tx, shutdown_result ))
8948
+ return Ok((closing_signed, signed_tx_shutdown ))
8950
8949
};
8951
8950
}
8952
8951
0 commit comments