Skip to content

fix(wallet): await for wallet settle before resolving cip30 utxo LW-12197 #1578

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

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

mkazlauskas
Copy link
Member

@mkazlauskas mkazlauskas commented Jan 31, 2025

Context

there was a race condition that made cip30 transaction chaining flaky:

  • we see a new block, we fetch transactions
  • we see transaction on chain and we do the following in parallel:
    • we fetch utxos
    • we remove transaction from inFlight$
      • spent utxo becomes 'available' again for a brief period, until utxos are fetched

if getUtxos is called after wallet sees transaction on chain,
but before utxos are fetched from provider, it would resolve spent utxo

Proposed Solution

await for wallet to settle before resolving utxo

Important Changes Introduced

@mkazlauskas mkazlauskas requested a review from rhyslbw January 31, 2025 06:20
@mkazlauskas mkazlauskas changed the title fix(wallet): await for wallet settle before resolving cip30 utxo fix(wallet): await for wallet settle before resolving cip30 utxo LW-12197 Jan 31, 2025
there was a race condition that made cip30 transaction chaining flaky:
- we see a new block, we fetch transactions
- we see transaction on chain and we do the following in parallel:
  - we fetch utxos
  - we remove transaction from inFlight$
    - spent utxo becomes 'available' again for a brief period,
      until utxos are fetched
if getUtxos is called after wallet sees transaction on chain,
but before utxos are fetched from provider, it would resolve spent utxo
@mkazlauskas mkazlauskas force-pushed the fix/settle-before-resolving-cip30-utxo branch from cf60bf6 to c478116 Compare January 31, 2025 07:08
@rhyslbw rhyslbw merged commit 02543e8 into master Jan 31, 2025
5 of 6 checks passed
@rhyslbw rhyslbw deleted the fix/settle-before-resolving-cip30-utxo branch January 31, 2025 11:55
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