Page MenuHomePhabricator

[Cashtab] Lock the UI until initial utxo sync is complete
ClosedPublic

Authored by bytesofman on Sep 2 2025, 21:45.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC369120dd2911: [Cashtab] Lock the UI until initial utxo sync is complete
Summary

User feedback of repeated txids created, esp when rapid-fire using app or extension-created txs. The likely cause is that Cashtab UI loads unlocked before the utxos sync. This was an intentional design decision from back when this kind of use case did not exist, and utxo syncing without chronik took much longer.

To balance current priorities, we introduce a lighter method, startupUtxoSync, which is called only at app startup and only syncs the utxo set of the active wallet. This means load time is optimized for extension or webapp users who are not viewing tokens or tx history. We lock the UI until utxos are synced, ensuring that we do not attempt to create txs with a stale utxo set.

We still do the full update() on startup after unlocking the UI, as we call update() after completing startupUtxoSync.

Test Plan

npm test, npm run extension and use for rapid fire webapp txs e.g. at blitzchips, note no repeated txids

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bytesofman published this revision for review.Sep 2 2025, 22:04
bytesofman added inline comments.
cashtab/src/wallet/useWallet.ts
1123 ↗(On Diff #55466)

we used to call update() here. The UI would be unlocked already, and the user's full wallet state would be updated.

Now we call startupUtxoSync(). This function updates only the utxo set, then unlocks the UI by setting initialUtxoSyncComplete to true.

startupUtxoSync() calls update, so we get the same behavior as before. We have some extra API work on startup, as now we make two calls for chronik.utxos (since we do it in startupUtxoSync and in update).

imo this is acceptable, as the complication of further customizing update to work with this one-off startup situation is not worth the impact of saving this call...and anyway, update is called after startupUtxoSync ... perhaps the utxos have indeed changed.

This revision is now accepted and ready to land.Sep 3 2025, 15:17