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

Recoverer/claim broadcasting race causes permanent duplicate payment in local instance #725

Open
1 of 2 tasks
danielgranhao opened this issue Feb 6, 2025 · 1 comment · May be fixed by #733
Open
1 of 2 tasks
Labels
bug Something isn't working high priority Should be prioritized over others
Milestone

Comments

@danielgranhao
Copy link
Contributor

danielgranhao commented Feb 6, 2025

The issue occurs as follows:

  1. Atrack_new_blocks loop iteration starts, and does a full scan of the liquid onchain wallet
  2. A receive swap claim tx is broadcasted (and the claim tx id is set in the db)
  3. The same track_new_blocks iteration continues and tries to recover data from the swap. 2 txs are found in the lockup script history, both pending (due to 0-conf), but neither are known local wallet txs (wallet is out of date), so we see the log: Found unconfirmed lockup and refund txs while recovering data for Receive Swap Jusa6EMuaCRd. End result is that the swap gets both its lockup and claim tx id cleared.
  4. Swapper sends duplicate update transaction.mempool (see Network issues can cause same swap to be subscribed to multiple times #704). Given the claim tx id was erased, we proceed with broadcasting a new claim tx
  5. Only one of the claim txs confirms, but the other still gets added to the payment_tx_data table. There is no implemented mechanism to clean this table, causing a permanent pending payment to appear in the payments list.

We should:

  • Prevent the race issue between the claiming and the recoverer tasks
  • As a fallback, add some mechanism for cleaning the payment_tx_data table as part of the recovery - Clean payment txs data on sync #731
@danielgranhao danielgranhao added the bug Something isn't working label Feb 6, 2025
@roeierez
Copy link
Member

roeierez commented Feb 6, 2025

Great analysis @danielgranhao !

@roeierez roeierez added this to the v0.7.0 milestone Feb 8, 2025
@roeierez roeierez added the high priority Should be prioritized over others label Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority Should be prioritized over others
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants