spesmilo / spesmilo/electrum

user may lose funds in a submarine swap, if their channel is force closed.

Open
#8,940 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.6k
Forks
3.5k
Avg merge
2d 8h
Merged PRs (30d)
61

Description

Scenario:

  • Alice has a channel with Bob
  • Alice initiates a normal swap with Carol.
  • Alice receives a HTLC from Carol, through Bob
  • Alice sends on-chain funds to the swap funding address
  • Alice goes offline.
  • The swap funding transaction gets confirmed.
  • Carol publishes the claim transaction, with the preimage.
  • Time passes, and the HTLC between Alice and Bob expires. Bob force closes the channel.
  • More time passes, and the CSV delay expires, Bob now redeems the HTLC.

I do not think this is fixable; this is a consequence of the new protocol. (note: In the old protocol, Alice sends on-chain funds before she receives the HTLC. She has the preimage and settles the HTLC instantly).

Note that the GUI currently shows a dialog instructing the user to stay online until the funding transaction is confirmed.
However, that dialog is shown when the user initiates the swap, and the risk might not be understood.
I think we should also show a dialog when the GUI is closed.

If Alice shuts down her client while a swap is ongoing, the GUI could show a dialog offering several choices:

  • cancel the swap (using a double spend)
  • run the risk (promise to come back online soon)

edit: cancelling the swap does not guarantee that the swap funding transaction will not be mined

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the GUI shutdown path for an ongoing submarine swap and the existing dialog shown when the swap is initiated. Decide how the close-time choices should be presented, including the caveat that cancellation does not guarantee the funding transaction will not be mined. Done means the shutdown flow clearly warns about the risk and offers the agreed behavior; the issue names no files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop, payments
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.