Skip to content

Conversation

@bordalix
Copy link
Contributor

@bordalix bordalix commented Oct 15, 2025

Summary by CodeRabbit

  • New Features
    • Sends a UTXO update even when no new outputs are found, ensuring clients stay informed of “no-change” events.
  • Bug Fixes
    • More consistent transaction handling reduces edge-case failures related to confirmation checks.
  • Refactor
    • Standardized transaction value formats for improved consistency across the app.

@bordalix bordalix requested a review from louisinger October 15, 2025 18:49
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 15, 2025

Walkthrough

Type and validation adjustments in onchain provider update ExplorerTransaction.vout.value from string to number and simplify status checks. Service worker now always broadcasts a utxoUpdate, even when newUtxos is empty, instead of returning early.

Changes

Cohort / File(s) Summary
Onchain provider types & validation
src/providers/onchain.ts
Updated isExplorerTransaction: vout.value must be a number (was string). Removed tx.status.block_time validation; retains status.confirmed check. Public type for ExplorerTransaction.vout.value updated to number.
Service worker UTXO notification flow
src/wallet/serviceWorker/worker.ts
Modified control flow: when newUtxos is empty, broadcast an empty utxoUpdate to all clients instead of returning early.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant SW as ServiceWorker
  participant UTXO as UTXO Source
  participant C1 as Client A
  participant C2 as Client B

  UTXO->>SW: newUtxos computed
  alt newUtxos length > 0
    SW->>C1: postMessage utxoUpdate(newUtxos)
    SW->>C2: postMessage utxoUpdate(newUtxos)
  else newUtxos length == 0
    Note over SW: New behavior
    SW->>C1: postMessage utxoUpdate([])
    SW->>C2: postMessage utxoUpdate([])
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • altafan

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly highlights the fix to the WebSocket notification logic in the serviceWorker, which is the primary focus of the changeset, and titles need not cover every detail to convey their main intent clearly.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_ws_notification

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9c773d0 and d2913f7.

📒 Files selected for processing (2)
  • src/providers/onchain.ts (1 hunks)
  • src/wallet/serviceWorker/worker.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test
🔇 Additional comments (2)
src/providers/onchain.ts (1)

185-186: block_time always defined for confirmed transactions
ExplorerTransaction.status.block_time is non-optional when confirmed and txKey is built only on those, so keys like txid_undefined cannot occur.

src/wallet/serviceWorker/worker.ts (1)

197-200: Confirm empty UTXO notifications
Unlike VTXO updates (which return early when empty), this now emits utxoUpdate([]) at lines 197–200. We found no client-side filtering of empty updates—please verify this is intentional and won’t trigger unnecessary UI rerenders.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

typeof tx.status === "object" &&
typeof tx.status.confirmed === "boolean" &&
typeof tx.status.block_time === "number"
typeof tx.status.confirmed === "boolean"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure of this? Usually is string BigInt in json

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comes from mempool websocket, we double checked it's a number not a string.

@tiero tiero merged commit 510e487 into master Oct 15, 2025
2 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Oct 18, 2025
@louisinger louisinger deleted the fix_ws_notification branch December 29, 2025 10:13
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