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

fix: remove leftover 'async' marker from tx drafting function [READ] #81

Merged
merged 3 commits into from
Aug 17, 2024

Conversation

coolaj86
Copy link
Member

Related to some of what was reviewed here: https://www.youtube.com/watch?v=7TBHmndBx00

It's actually IMPORTANT for the the drafting functions to NOT be async - it helps prevent duplicate spend issues and general state management issues (i.e. another process could request the same address).

Here's another summary of the tx lifecycle:

  1. sync draftTx
  2. (??) reserveFundsInWallet
  3. backfill & await signTx
  4. await broadcastTx
  5. (??) commitWalletState

We want the loop between the draft and the reserve to be as close as possible so that other tasks can't use them, and without having to depend on storage and sync implementation details of the wallet.

@coolaj86 coolaj86 added documentation Improvements or additions to documentation question Further information is requested labels Aug 17, 2024
@coolaj86 coolaj86 merged commit ee98a2b into main Aug 17, 2024
5 checks passed
@coolaj86 coolaj86 deleted the fix-non-async branch August 17, 2024 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant