ACINQ / phoenix

Phoenix is a self-custodial Bitcoin wallet using Lightning to send/receive payments.
https://phoenix.acinq.co
Apache License 2.0
632 stars 95 forks source link

Merge channels when upgrading an existing iOS wallet to splice #395

Closed dpad85 closed 11 months ago

dpad85 commented 11 months ago

This PR adds a method that consolidates all existing channels into one new single channel with support for dual funding.

This is especially useful for the iOS app. It allows existing iOS wallets with non-dual funding channels to migrate to dual-funded channels.

robbiehanson commented 11 months ago

When the user launches the new version on iOS for the first time, then they're greeted with this screen (if they already have a wallet):



I've added some nice little fireworks animations that explode on the screen in random locations.

When the user clicks "get started", then we call the consolidateChannels function. And if it finishes successfully, then this view disappears, and the user sees the normal wallet screen. If all went well, this means their channels were all closed, and they have a new channel with zero-conf, meaning their balance is immediately available.

However, there are a lot of edge cases.

For these reasons:

Now if the user skips, or aborts, or the consolidateChannels function otherwise fails to finish the job, then:



Note how "Receive" and "Send" are in red. This is triggered whenever the canConsolidate function returns true. And if the user taps these buttons, they're prompted to perform the merge again: