Skip to content
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/ln dlc/renew after disconnect #143

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

Tibo-lg
Copy link
Contributor

@Tibo-lg Tibo-lg commented Aug 28, 2023

Fix for the bug mentioned here where settling a dlc channel after disconnecting during the opening errors.

@Tibo-lg Tibo-lg changed the base branch from master to feature/ln-dlc-channels August 28, 2023 12:08
Copy link
Collaborator

@luckysori luckysori left a comment

Choose a reason for hiding this comment

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

LGTM!

@Tibo-lg Tibo-lg force-pushed the fix/ln-dlc/renew-after-disconnect branch 3 times, most recently from 456a63e to a8070aa Compare September 4, 2023 04:14
@Tibo-lg
Copy link
Contributor Author

Tibo-lg commented Sep 4, 2023

@luckysori I think this is finally ready to be reviewed. There was actually several bugs related to revocation secrets. I added checks that helped find the issues, but I also opened #146 as I think it'd be better to have tests for that.

Copy link
Collaborator

@luckysori luckysori left a comment

Choose a reason for hiding this comment

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

LGTM!

I think the second patch is already in the feature/ln-dlc-channels.

@@ -60,7 +60,7 @@ impl_dlc_writeable_enum!(
(6, RenewOffered, {(offered_contract_id, writeable), (counter_payout, writeable), (is_offer, writeable), (offer_next_per_update_point, writeable), (timeout, writeable)}),
(7, RenewAccepted, {(contract_id, writeable), (offer_per_update_point, writeable), (accept_per_update_point, writeable), (buffer_transaction, writeable), (buffer_script_pubkey, writeable), (timeout, writeable), (own_payout, writeable)}),
(8, RenewConfirmed, {(contract_id, writeable), (offer_per_update_point, writeable), (accept_per_update_point, writeable), (buffer_transaction, writeable), (buffer_script_pubkey, writeable), (offer_buffer_adaptor_signature, {cb_writeable, write_ecdsa_adaptor_signature, read_ecdsa_adaptor_signature}), (timeout, writeable), (own_payout, writeable), (total_collateral, writeable)}),
(10, RenewFinalized, {(contract_id, writeable), (offer_per_update_point, writeable), (accept_per_update_point, writeable), (buffer_transaction, writeable), (buffer_script_pubkey, writeable), (offer_buffer_adaptor_signature, {cb_writeable, write_ecdsa_adaptor_signature, read_ecdsa_adaptor_signature}), (accept_buffer_adaptor_signature, {cb_writeable, write_ecdsa_adaptor_signature, read_ecdsa_adaptor_signature}), (timeout, writeable), (own_payout, writeable), (total_collateral, writeable)}),
(10, RenewFinalized, {(contract_id, writeable), (prev_offer_per_update_point, writeable), (buffer_transaction, writeable), (buffer_script_pubkey, writeable), (offer_buffer_adaptor_signature, {cb_writeable, write_ecdsa_adaptor_signature, read_ecdsa_adaptor_signature}), (accept_buffer_adaptor_signature, {cb_writeable, write_ecdsa_adaptor_signature, read_ecdsa_adaptor_signature}), (timeout, writeable), (own_payout, writeable), (total_collateral, writeable)}),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Reminder for consumers that this will break any channel stuck in this state prior to this patch. Cc @holzeis.

Copy link
Collaborator

Choose a reason for hiding this comment

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

you mean any channel that is already stuck?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, if a channel is currently in RenewFinalized we won't be able to load it after we update to this patch.

Comment on lines +267 to +269
/// The previous per update point that was used by the offer party for the previous
/// state of the channel.
prev_offer_per_update_point: PublicKey,
Copy link
Collaborator

Choose a reason for hiding this comment

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

How come we can forget about offer_per_update_point and accept_per_update_point here? And why do we suddenly care about the previous offer per update point?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IIRC the offer_per_updated_point was not really used and/or redundant with the own_/counter_per_update_point of the SignedChannel struct. The reason for caring about the previous one is to be able to verify that the revocation secret we receive later matches with the point we had.

@Tibo-lg Tibo-lg force-pushed the fix/ln-dlc/renew-after-disconnect branch from a8070aa to 456e494 Compare October 11, 2023 00:03
@Tibo-lg Tibo-lg merged commit 49c0c20 into feature/ln-dlc-channels Oct 11, 2023
194 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants