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

Add error handling for channels which fail to be created in funding_transaction_generated_intern #3029

Conversation

TheBlueMatt
Copy link
Collaborator

See individual commits for more details.

@codecov-commenter
Copy link

codecov-commenter commented Apr 29, 2024

Codecov Report

Attention: Patch coverage is 94.52055% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 89.15%. Comparing base (2b14cc4) to head (b811cba).

Files Patch % Lines
lightning/src/ln/channelmanager.rs 89.74% 4 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3029   +/-   ##
=======================================
  Coverage   89.14%   89.15%           
=======================================
  Files         118      118           
  Lines       97850    97889   +39     
  Branches    97850    97889   +39     
=======================================
+ Hits        87230    87271   +41     
+ Misses       8376     8372    -4     
- Partials     2244     2246    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TheBlueMatt TheBlueMatt force-pushed the 2024-04-fix-batch-funding-failures branch 2 times, most recently from 76d13e2 to 5231799 Compare April 29, 2024 21:13
In `funding_transaction_generated_intern`, if `find_funding_output`
fails (e.g. due to the require output not being present in the
provided funding transaction) we'd previously not generated a
`ChannelClosed` event which leaves users possibly in a confused
state.

Here we fix this, also fixing the relevant tests to check for the
new event.

Fixes lightningdevkit#2843.
If we fail to fund a batch open we'll force-close all channels in
the batch, however would previously fail to send error messages to
our peers for any channels we were due to test after the one that
failed.

This commit fixes that issue, sending the required error messages
to allow our peers to clean up their state.
@TheBlueMatt TheBlueMatt force-pushed the 2024-04-fix-batch-funding-failures branch from 5231799 to b811cba Compare April 30, 2024 13:43
@valentinewallace valentinewallace self-requested a review May 1, 2024 16:01
Copy link
Contributor

@valentinewallace valentinewallace left a comment

Choose a reason for hiding this comment

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

LGTM, tests fail as expected and the patch is pretty small. I'm not too familiar with the batch funding flow though so not sure if we want a glance from @wpaulino or @wvanlint.

Copy link
Contributor

@wpaulino wpaulino left a comment

Choose a reason for hiding this comment

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

We've had a couple of these mishandling cleanup issues lately, really wish we had a better abstraction to handle them.

get_event_msg!(nodes[0], MessageSendEvent::SendFundingCreated, nodes[1].node.get_our_node_id());
let msgs = nodes[0].node.get_and_clear_pending_msg_events();
assert_eq!(msgs.len(), 2);
// We currently spuriously send `FundingCreated` for the first channel and then immediately
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it too much trouble to hold back sending until we know the batch succeeds?

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 mean we could but I don't really want to add any more error handling than we need to....

@TheBlueMatt
Copy link
Collaborator Author

We've had a couple of these mishandling cleanup issues lately, really wish we had a better abstraction to handle them.

Yea, we improved it a bit in a previous PR, but, yea, more would be good...

@TheBlueMatt TheBlueMatt merged commit 3d5a691 into lightningdevkit:main May 3, 2024
12 of 16 checks passed
TheBlueMatt added a commit to TheBlueMatt/rust-lightning that referenced this pull request May 6, 2024
…batch-funding-failures

Add error handling for channels which fail to be created in `funding_transaction_generated_intern`
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.

Add error handling for channels which fail to be created in funding_transaction_generated_intern
4 participants