rust-lightning icon indicating copy to clipboard operation
rust-lightning copied to clipboard

Don't attempt to resume channels if we already exchanged funding

Open TheBlueMatt opened this issue 1 year ago • 1 comments

ddf75afd16 introduced the ability to re-exchange our ChannelOpen after a peer disconnects if we didn't complete funding on our end. It did not implement nor consider what would happen if we re-connected after we created our own funding transactions, and currently it panics (and even if it did not it would replay the FundingTransactionGenerated event to users).

While we'd very much like to replay the open_channel flow even if we have already received an accept_channel and funded the channel, we cannot as the peer will likely provide different key material in their accept_channel, causing us to need a different funding transaction.

Thus, here, we simply close channels which have been funded but not yet signed when our peer disconnects.

Replaces https://github.com/lightningdevkit/rust-lightning/pull/2983#issuecomment-2095794973 Note that this is the same as the version we already landed for 0.0.123, but I was hoping we could do more, but sadly @shaavan pointed out we cannot.

TheBlueMatt avatar May 07 '24 22:05 TheBlueMatt

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 89.80%. Comparing base (1d421d3) to head (53cd31a).

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3051      +/-   ##
==========================================
- Coverage   89.88%   89.80%   -0.08%     
==========================================
  Files         117      117              
  Lines       96958    96993      +35     
  Branches    96958    96993      +35     
==========================================
- Hits        87146    87106      -40     
- Misses       7268     7323      +55     
- Partials     2544     2564      +20     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar May 07 '24 22:05 codecov-commenter

Fuzz is failing. Otherwise this is the same as #3034 so should be able to Just Land.

valentinewallace avatar May 21 '24 14:05 valentinewallace

Just needed a rebase.

TheBlueMatt avatar May 28 '24 15:05 TheBlueMatt

Its just one commit already in a release, merging.

TheBlueMatt avatar May 28 '24 17:05 TheBlueMatt