-
Notifications
You must be signed in to change notification settings - Fork 405
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
Fix EnforcingChannelKeys panic when our counterparty burns their $. #445
Conversation
76c52b0
to
f6f6512
Compare
f6f6512
to
51f96c4
Compare
lightning/src/ln/functional_tests.rs
Outdated
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
51f96c4
to
ecfe862
Compare
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.
ecfe862
to
1443509
Compare
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.