Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send: Fix double-lockup when payment is TimedOut #541

Merged
merged 6 commits into from
Oct 31, 2024

Conversation

hydra-yse
Copy link
Collaborator

@hydra-yse hydra-yse commented Oct 28, 2024

Given the current event loop, TimedOut payments may cause lockups to be broadcast.

This PR changes the send flow such that:

  1. When a user calls send_payment, the lockup is broadcasted within that same thread only if it hasn't been broadcasted beforehand
  2. The background thread (Boltz status stream) does not execute lockups any longer

TODO: Persist lockup_tx_id beforehand to ensure we don't broadcast twice in case the client closes the application before the new state is saved

@hydra-yse hydra-yse self-assigned this Oct 28, 2024
lib/core/src/sdk.rs Show resolved Hide resolved
Copy link
Member

@roeierez roeierez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I think there is one small race issue we need to solve.

lib/core/src/sdk.rs Outdated Show resolved Hide resolved
Copy link
Member

@roeierez roeierez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment, otherwise looks good to me.

lib/core/src/persist/send.rs Outdated Show resolved Hide resolved
@hydra-yse hydra-yse requested a review from ok300 October 31, 2024 13:48
@hydra-yse hydra-yse merged commit 22e98f0 into main Oct 31, 2024
8 checks passed
roeierez added a commit that referenced this pull request Nov 5, 2024
* commit 'a515718dc72c1c8eb62cecb7ad9c9862e8dc727c':
  feat: allow send transition from `TimedOut` to `Created` (#545)
  Propagate signer interface changes (#544)
  fix: double-lockup when payment is TimedOut (#541)
  Reserved address pool (#531)
  Prevent swap double claim (#542)
  Receive Chain Swap: support refund even when lockup address is re-used (#471)
  Bring remaining u32 amount types to u64 (#537)
  Add swift framework plists (#536)
  Update README.md
  Update README.md
  Update roadmap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants