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
6129
+
// funding.
6130
+
let channel_ready = if self.context.signer_pending_channel_ready && !self.context.signer_pending_funding {
6131
+
log_trace!(logger, "Attempting to generate pending channel_ready...");
6132
+
self.get_channel_ready(logger)
6125
6133
} else { None };
6126
6134
6127
6135
let mut commitment_update = if self.context.signer_pending_commitment_update {
@@ -6428,7 +6436,7 @@ impl<SP: Deref> Channel<SP> where
6428
6436
6429
6437
// We have OurChannelReady set!
6430
6438
return Ok(ReestablishResponses {
6431
-
channel_ready: Some(self.get_channel_ready()),
6439
+
channel_ready: self.get_channel_ready(logger),
6432
6440
raa: None, commitment_update: None,
6433
6441
order: RAACommitmentOrder::CommitmentFirst,
6434
6442
shutdown_msg, announcement_sigs,
@@ -6467,7 +6475,7 @@ impl<SP: Deref> Channel<SP> where
6467
6475
6468
6476
let channel_ready = if msg.next_local_commitment_number == 1 && INITIAL_COMMITMENT_NUMBER - self.holder_commitment_point.transaction_number() == 1 {
6469
6477
// We should never have to worry about MonitorUpdateInProgress resending ChannelReady
6470
-
Some(self.get_channel_ready())
6478
+
self.get_channel_ready(logger)
6471
6479
} else { None };
6472
6480
6473
6481
if msg.next_local_commitment_number == next_counterparty_commitment_number {
@@ -7322,14 +7330,6 @@ impl<SP: Deref> Channel<SP> where
7322
7330
return None;
7323
7331
}
7324
7332
7325
-
// If we're still pending the signature on a funding transaction, then we're not ready to send a
7326
-
// channel_ready yet.
7327
-
if self.context.signer_pending_funding {
7328
-
// TODO: set signer_pending_channel_ready
7329
-
log_debug!(logger, "Can't produce channel_ready: the signer is pending funding.");
7330
-
return None;
7331
-
}
7332
-
7333
7333
// Note that we don't include ChannelState::WaitingForBatch as we don't want to send
7334
7334
// channel_ready until the entire batch is ready.
7335
7335
let need_commitment_update = if matches!(self.context.channel_state, ChannelState::AwaitingChannelReady(f) if f.clone().clear(FundedStateFlags::ALL.into()).is_empty()) {
@@ -7375,18 +7375,23 @@ impl<SP: Deref> Channel<SP> where
7375
7375
return None;
7376
7376
}
7377
7377
7378
-
// TODO: when get_per_commiment_point becomes async, check if the point is
7379
-
// available, if not, set signer_pending_channel_ready and return None
0 commit comments