Skip to content

Commit

Permalink
Clarify why we can't update tlc while awaiting RevokeAndAck
Browse files Browse the repository at this point in the history
  • Loading branch information
contrun committed Jun 13, 2024
1 parent e22ceed commit 3920ae1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/ckb/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,18 @@ impl ChannelActorState {

pub fn check_state_for_tlc_update(&self) -> ProcessingChannelResult {
match self.state {
ChannelState::ChannelReady(flags) if flags.is_empty() => Ok(()),
ChannelState::ChannelReady(flags) => {
// TODO: Even if we are awaiting remote revoke, we should still stash these tlc updates,
// and perform corresponding actions after we receive the revoke_and_ack message.
if flags.contains(ChannelReadyFlags::AWAITING_REMOTE_REVOKE) {
Err(ProcessingChannelError::InvalidState(
"Trying to update tlc while channel is awaiting remote revocation"
.to_string(),
))
} else {
Ok(())
}
}
ChannelState::ShuttingDown(_) => Ok(()),
_ => Err(ProcessingChannelError::InvalidState(format!(
"Invalid state {:?} for adding tlc",
Expand Down

0 comments on commit 3920ae1

Please sign in to comment.