@@ -8819,10 +8819,7 @@ where
8819
8819
8820
8820
pub fn maybe_propose_closing_signed<F: Deref, L: Deref>(
8821
8821
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, logger: &L,
8822
- ) -> Result<
8823
- (Option<msgs::ClosingSigned>, Option<Transaction>, Option<ShutdownResult>),
8824
- ChannelError,
8825
- >
8822
+ ) -> Result<(Option<msgs::ClosingSigned>, Option<(Transaction, ShutdownResult)>), ChannelError>
8826
8823
where
8827
8824
F::Target: FeeEstimator,
8828
8825
L::Target: Logger,
@@ -8832,20 +8829,20 @@ where
8832
8829
// initiate `closing_signed` negotiation until we're clear of all pending messages. Note
8833
8830
// that closing_negotiation_ready checks this case (as well as a few others).
8834
8831
if self.context.last_sent_closing_fee.is_some() || !self.closing_negotiation_ready() {
8835
- return Ok((None, None, None ));
8832
+ return Ok((None, None));
8836
8833
}
8837
8834
8838
8835
if !self.funding.is_outbound() {
8839
8836
if let Some(msg) = &self.context.pending_counterparty_closing_signed.take() {
8840
8837
return self.closing_signed(fee_estimator, &msg, logger);
8841
8838
}
8842
- return Ok((None, None, None ));
8839
+ return Ok((None, None));
8843
8840
}
8844
8841
8845
8842
// If we're waiting on a counterparty `commitment_signed` to clear some updates from our
8846
8843
// local commitment transaction, we can't yet initiate `closing_signed` negotiation.
8847
8844
if self.context.expecting_peer_commitment_signed {
8848
- return Ok((None, None, None ));
8845
+ return Ok((None, None));
8849
8846
}
8850
8847
8851
8848
let (our_min_fee, our_max_fee) = self.calculate_closing_fee_limits(fee_estimator);
@@ -8864,7 +8861,7 @@ where
8864
8861
our_max_fee,
8865
8862
logger,
8866
8863
);
8867
- Ok((closing_signed, None, None ))
8864
+ Ok((closing_signed, None))
8868
8865
}
8869
8866
8870
8867
fn mark_response_received(&mut self) {
@@ -9127,10 +9124,7 @@ where
9127
9124
pub fn closing_signed<F: Deref, L: Deref>(
9128
9125
&mut self, fee_estimator: &LowerBoundedFeeEstimator<F>, msg: &msgs::ClosingSigned,
9129
9126
logger: &L,
9130
- ) -> Result<
9131
- (Option<msgs::ClosingSigned>, Option<Transaction>, Option<ShutdownResult>),
9132
- ChannelError,
9133
- >
9127
+ ) -> Result<(Option<msgs::ClosingSigned>, Option<(Transaction, ShutdownResult)>), ChannelError>
9134
9128
where
9135
9129
F::Target: FeeEstimator,
9136
9130
L::Target: Logger,
@@ -9170,7 +9164,7 @@ where
9170
9164
9171
9165
if self.context.channel_state.is_monitor_update_in_progress() {
9172
9166
self.context.pending_counterparty_closing_signed = Some(msg.clone());
9173
- return Ok((None, None, None ));
9167
+ return Ok((None, None));
9174
9168
}
9175
9169
9176
9170
let funding_redeemscript = self.funding.get_funding_redeemscript();
@@ -9224,7 +9218,7 @@ where
9224
9218
self.build_signed_closing_transaction(&mut closing_tx, &msg.signature, &sig);
9225
9219
self.context.channel_state = ChannelState::ShutdownComplete;
9226
9220
self.context.update_time_counter += 1;
9227
- return Ok((None, Some(tx), Some( shutdown_result)));
9221
+ return Ok((None, Some((tx, shutdown_result) )));
9228
9222
}
9229
9223
}
9230
9224
@@ -9247,26 +9241,25 @@ where
9247
9241
our_max_fee,
9248
9242
logger,
9249
9243
);
9250
- let (signed_tx, shutdown_result) = if $new_fee == msg.fee_satoshis {
9251
- let shutdown_result =
9252
- closing_signed.as_ref().map(|_| self.shutdown_result_coop_close());
9253
- if closing_signed.is_some() {
9254
- self.context.channel_state = ChannelState::ShutdownComplete;
9255
- }
9244
+ let signed_tx_shutdown = if $new_fee == msg.fee_satoshis {
9256
9245
self.context.update_time_counter += 1;
9257
9246
self.context.last_received_closing_sig = Some(msg.signature.clone());
9258
- let tx = closing_signed.as_ref().map(|ClosingSigned { signature, .. }| {
9259
- self.build_signed_closing_transaction(
9247
+ if let Some(ClosingSigned { signature, .. }) = &closing_signed {
9248
+ let shutdown_result = self.shutdown_result_coop_close();
9249
+ self.context.channel_state = ChannelState::ShutdownComplete;
9250
+ let tx = self.build_signed_closing_transaction(
9260
9251
&closing_tx,
9261
9252
&msg.signature,
9262
9253
signature,
9263
- )
9264
- });
9265
- (tx, shutdown_result)
9254
+ );
9255
+ Some((tx, shutdown_result))
9256
+ } else {
9257
+ None
9258
+ }
9266
9259
} else {
9267
- ( None, None)
9260
+ None
9268
9261
};
9269
- return Ok((closing_signed, signed_tx, shutdown_result ))
9262
+ return Ok((closing_signed, signed_tx_shutdown ))
9270
9263
};
9271
9264
}
9272
9265
0 commit comments