hypercore-one / syrius

MIT License
0 stars 0 forks source link

Refactor expiration warnings and increase counter HTLC duration #42

Closed vilkris4 closed 1 year ago

vilkris4 commented 1 year ago

Based on tester feedback, the counter HTLC duration of a P2P swap has been increased to 1 hour, so that the user has a little more time to complete the swap. The changes to the P2P swap constants now guarantee that:

  1. The starting party has ~50 minutes to execute the swap after the counterparty has joined the swap (kCounterHtlcDuration - kMinSafeTimeToCompleteSwap).
  2. The joining party has ~1 hour to join the swap after the swap has been started (kInitialHtlcDuration - kCounterHtlcDuration - kMinSafeTimeToFindPreimage).
  3. The joining party has at least ~6 hours to find the preimage after the starting party has executed the swap (kMinSafeTimeToFindPreimage).

The expiration warnings from the HtlcCard widget have been removed and a new "swap expiration warning" has been added to the NativeP2pSwapModal. This warning takes the kMinSafeTimeToCompleteSwap into account when showing the remaining time to complete the swap, as opposed to the HtlcCard's warning that only showed the actual expiration time of the HTLC, misguiding the user of the actual time left to complete the swap.

In addition, the swap is now marked as expired when the time until the counter HTLC expires is less than kMinSafeTimeToCompleteSwap.

The new swap expiration warning: expires