You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Handle fallible commitment point when getting channel_ready
Here we handle the case where our signer is pending the next commitment
point when we try to send channel ready. We set a flag to remember to
send this message when our signer is unblocked. This follows the same
general pattern as everywhere else where we're waiting on a commitment
point from the signer in order to send a message.
// Provide a `channel_ready` message if we need to, but only if we're _not_ still pending
6113
+
// funding.
6114
+
let channel_ready = if self.context.signer_pending_channel_ready && !self.context.signer_pending_funding {
6115
+
log_trace!(logger, "Attempting to generate pending channel_ready...");
6116
+
self.get_channel_ready(logger)
6109
6117
} else { None };
6110
6118
6111
6119
let mut commitment_update = if self.context.signer_pending_commitment_update {
@@ -6404,7 +6412,7 @@ impl<SP: Deref> Channel<SP> where
6404
6412
6405
6413
// We have OurChannelReady set!
6406
6414
return Ok(ReestablishResponses {
6407
-
channel_ready: Some(self.get_channel_ready()),
6415
+
channel_ready: self.get_channel_ready(logger),
6408
6416
raa: None, commitment_update: None,
6409
6417
order: RAACommitmentOrder::CommitmentFirst,
6410
6418
shutdown_msg, announcement_sigs,
@@ -6443,7 +6451,7 @@ impl<SP: Deref> Channel<SP> where
6443
6451
6444
6452
let channel_ready = if msg.next_local_commitment_number == 1 && INITIAL_COMMITMENT_NUMBER - self.holder_commitment_point.transaction_number() == 1 {
6445
6453
// We should never have to worry about MonitorUpdateInProgress resending ChannelReady
6446
-
Some(self.get_channel_ready())
6454
+
self.get_channel_ready(logger)
6447
6455
} else { None };
6448
6456
6449
6457
if msg.next_local_commitment_number == next_counterparty_commitment_number {
@@ -7298,14 +7306,6 @@ impl<SP: Deref> Channel<SP> where
7298
7306
return None;
7299
7307
}
7300
7308
7301
-
// If we're still pending the signature on a funding transaction, then we're not ready to send a
7302
-
// channel_ready yet.
7303
-
if self.context.signer_pending_funding {
7304
-
// TODO: set signer_pending_channel_ready
7305
-
log_debug!(logger, "Can't produce channel_ready: the signer is pending funding.");
7306
-
return None;
7307
-
}
7308
-
7309
7309
// Note that we don't include ChannelState::WaitingForBatch as we don't want to send
7310
7310
// channel_ready until the entire batch is ready.
7311
7311
let need_commitment_update = if matches!(self.context.channel_state, ChannelState::AwaitingChannelReady(f) if f.clone().clear(FundedStateFlags::ALL.into()).is_empty()) {
@@ -7351,18 +7351,23 @@ impl<SP: Deref> Channel<SP> where
7351
7351
return None;
7352
7352
}
7353
7353
7354
-
// TODO: when get_per_commiment_point becomes async, check if the point is
7355
-
// available, if not, set signer_pending_channel_ready and return None
0 commit comments