ACINQ / phoenix

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

Display swap-in grace period & timeouts #444

Closed dpad85 closed 8 months ago

dpad85 commented 9 months ago

Phoenix uses the swap-in potentiam scheme to trustlessly swap on-chain deposits to Lightning with 0 confirmations channels.

This scheme introduces a duration of 4 months during which swaps can be attempted. After this four months have passed, deposits that have not been swapped time out and enter a grace period of two months. After this two months period has passed, these deposits can be unilaterally spent by the user's wallet to any address.

Getting the closest timeout

PeerManager exposes a new swapInNextTimeout flow that contains a Pair of Utxo -> Block to timeout.

Swap-in screen

This PR improves the swap-in screen by discriminating funds according to their status (confirming, swappable, timed-out, and cancelled), based on their confirmation count.

Note that in the screenshot below, the timeout was set to 1 month for a test, but production value is 4 months.

Screenshot_20231013_165303

This elements are not clickable. The UI does not display the details of each UTXO with their remaining block count before timeout. I've tried doing this and it made things overwhelmingly complex while bringing no real utility to the user.

Notice in home

An important notice is also added to the home screen, if a swap is going to time out soon (< 1 month). Also the icon changes to /!\ if the timeout is less than a day (not the case on the screenshot below).

Screenshot_20231013_165833

System notification

The notifications for pending deposits will mention the timeout if it is available at the time of the notification.

Screenshot_20231013_165557