|
| 1 | +--- |
| 2 | +layout: pr |
| 3 | +date: 2023-01-12 |
| 4 | +title: "Fix infinite loop when closing a pre-funding channel" |
| 5 | +pr: 2760 |
| 6 | +authors: [jbesraa] |
| 7 | +components: ["channel-establishment", "channel-funding"] |
| 8 | +host: jbesraa |
| 9 | +status: upcoming |
| 10 | +commit: |
| 11 | +--- |
| 12 | + |
| 13 | +## Notes |
| 14 | + Creating a channel involves exchanging multiple messages with a |
| 15 | + connected peer, which does not always end up successfully. |
| 16 | + Specifically, in the current implementation an infinite loop might occur |
| 17 | + in the funding step. |
| 18 | + This bug was resulted from [ldk/2077]. |
| 19 | + |
| 20 | + [ldk/2760] Addresses this bug. |
| 21 | + |
| 22 | + +-------+ +-------+ |
| 23 | + | |--(1)- open_channel ---->| | |
| 24 | + | |<-(2)- accept_channel ----| | |
| 25 | + | |--(3)- funding_created ->| | |
| 26 | + | |<-(4)- funding_signed ---| | |
| 27 | + | |--(5)- channel_ready --->| | |
| 28 | + | A |<-(6)- channel_ready ---| B | |
| 29 | + +-------+ +-------+ |
| 30 | + |
| 31 | +* Channel establishment(v1) is the process of creating a channel with a |
| 32 | + connected peer, as detailed here [lightning/bolt02]. |
| 33 | + |
| 34 | +## Questions |
| 35 | +1. Did you review the PR? [Concept ACK, approach ACK, tested ACK, or NACK](https://github.com/lightningdevkit/rust-lightning/blob/master/CONTRIBUTING.md#peer-review)? |
| 36 | +2. In the original code we have a loop inside `close_channel_internal`, |
| 37 | +in which scenario it goes indefintly? |
| 38 | +3. Why are we able to drop `force_close_channel_with_peer` from |
| 39 | +`close_channel_internal`, and `funding_created` msg from `SignerResumeUpdate`? |
| 40 | +4. What was the reasoning for promoting an `OutboundV1Channel` to a |
| 41 | +`Channel` before receiving `funding_signed` prior to this PR? Why |
| 42 | +do we no only do that promotion after receiving `funding_signed`? |
| 43 | + |
| 44 | +[lightning/bolt02]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#channel-establishment. |
| 45 | +[ldk/2077]: https://github.com/lightningdevkit/rust-lightning/pull/2077 |
| 46 | +[ldk/2760]: https://github.com/lightningdevkit/rust-lightning/pull/2760 |
0 commit comments