-
Notifications
You must be signed in to change notification settings - Fork 17
reset utxos #199
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
reset utxos #199
Conversation
WalkthroughThe service worker's UTXO handling and notifications were updated: mapped utxo variable renamed, early-return removed so flow always continues, boarding utxos are cleared before saving, client vtxo notifications are now awaited, and UTXO notification payloads/types changed to use ExtendedCoin[]. Changes
Sequence Diagram(s)sequenceDiagram
participant Worker as ServiceWorker
participant Repo as WalletRepository
participant Clients as Clients (broadcast)
Worker->>Worker: map funds -> utxos
Worker->>Repo: clearUtxos(boardingAddress)
Repo-->>Worker: cleared
Worker->>Repo: save(boardingAddress, utxos)
Repo-->>Worker: saved
Worker->>Clients: await broadcast.vtxoUpdate(vtxo)
Clients-->>Worker: ack
Worker->>Clients: broadcast.utxoUpdate(utxos as ExtendedCoin[])
Clients-->>Worker: ack
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code graph analysis (2)src/wallet/serviceWorker/worker.ts (1)
src/wallet/serviceWorker/response.ts (2)
🔇 Additional comments (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/wallet/serviceWorker/worker.ts(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/wallet/serviceWorker/worker.ts (1)
src/wallet/utils.ts (1)
extendCoin(21-28)
🔇 Additional comments (2)
src/wallet/serviceWorker/worker.ts (2)
193-195: LGTM: Variable naming aligns with new semantics.The rename from
newUtxostoutxosbetter reflects the "replace all" semantics introduced by theclearUtxoscall on line 206.
197-200: LGTM: Empty array handling is correct.The early return with an empty array notification is appropriate and efficient. It correctly signals to clients when no UTXOs are available.
src/wallet/serviceWorker/worker.ts
Outdated
| this.sendMessageToAllClients( | ||
| Response.utxoUpdate(funds.coins) | ||
| ); | ||
| this.sendMessageToAllClients(Response.utxoUpdate(utxos)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this async? why no await ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@louisinger please review
Summary by CodeRabbit