Skip to content

Fix channel_reestablish generation/handling around next_remote. #261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

TheBlueMatt
Copy link
Collaborator

With this reestablish actually works in practice and channels in rust-lightning-bitcoinrpc survive restart no problem.

Copy link

@ariard ariard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

msgs::ChannelReestablish {
channel_id: self.channel_id(),
next_local_commitment_number: INITIAL_COMMITMENT_NUMBER - self.cur_local_commitment_transaction_number,
next_remote_commitment_number: INITIAL_COMMITMENT_NUMBER - self.cur_remote_commitment_transaction_number -
if self.channel_state & (ChannelState::FundingSent as u32 | ChannelState::OurFundingLocked as u32) == (ChannelState::FundingSent as u32) { 1 } else { 0 },
// We have to set next_remote_commitment_number to the next revoke_and_ack we expect to
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yes bolt is quite unclear on dissociation between next_local_commitment_number and next_remote_commitment_number. Maybe comment could be more meaningful : "next_local_commitment_number is future index of our revocation secret for our next local_commitment_tx, whereas next_remote_commitment_number is present index at which we expect remote node reveals secret for its actual remote commitment tx secret in its next revoke_and_ack" Don't know if it's clearer but at least I've tried :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a ton more text, hopefully its all clear enough now.

@TheBlueMatt TheBlueMatt force-pushed the 2018-11-reestablish-fix branch from dcc7e84 to 23c2cef Compare December 2, 2018 22:26
@TheBlueMatt TheBlueMatt merged commit 0d7156f into lightningdevkit:master Dec 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants