dashhive / DashTx.js

Create TX hex for payments and such
MIT License
3 stars 0 forks source link

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

Closed coolaj86 closed 1 month ago

coolaj86 commented 1 month ago

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.