Skip to content

Fix EnforcingChannelKeys panic when our counterparty burns their $. #445

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

If our counterparty burns their funds by revoking their current
commitment transaction before we've sent them a new one, we'll step
forward the remote commitment number. This would be otherwise fine
(and may even encourage them to broadcast their revoked state(s) on
chain), except that our new EnforcingChannelKeys expects us to not
jump forward in time. Since it isn't too important that we punish
our counterparty in such a corner-case, we opt to just close the
channel in such a case and move on.

Comment on lines 6991 to 6993
let next_per_commitment_point = PublicKey::from_secret_key(&Secp256k1::new(),
&SecretKey::from_slice(&chan_utils::build_commitment_secret(&commitment_seed, (1 << 48) - 3)).unwrap());
let per_commitment_secret = chan_utils::build_commitment_secret(&commitment_seed, (1 << 48) - 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could what's going on with (1 << 48) - 3) and (1 << 48) - 3) be made more explicit somehow? Not sure of the best way to do it. Could be as simple as well named variables... or better yet an abstraction that hides this math but makes it clear that the commitment number was advanced one too many times.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A bit better? I copied the INITIAL_COMMITMENT_NUMBER const here to make the math clear.

@TheBlueMatt TheBlueMatt force-pushed the 2020-01-fuzz-enforcer-fix branch from 51f96c4 to ecfe862 Compare February 6, 2020 00:56
If our counterparty burns their funds by revoking their current
commitment transaction before we've sent them a new one, we'll step
forward the remote commitment number. This would be otherwise fine
(and may even encourage them to broadcast their revoked state(s) on
chain), except that our new EnforcingChannelKeys expects us to not
jump forward in time. Since it isn't too important that we punish
our counterparty in such a corner-case, we opt to just close the
channel in such a case and move on.
@TheBlueMatt TheBlueMatt force-pushed the 2020-01-fuzz-enforcer-fix branch from ecfe862 to 1443509 Compare February 8, 2020 01:03
@TheBlueMatt TheBlueMatt merged commit 88b7dcd into lightningdevkit:master Feb 10, 2020
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