Display swap-in grace period & timeouts #444
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 newswapInNextTimeout
flow that contains aPair
ofUtxo -> 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.
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).System notification
The notifications for pending deposits will mention the timeout if it is available at the time of the notification.