Skip to content

feat: add wear payments and the self-send guard - #2182

Open
jvsena42 wants to merge 33 commits into
masterfrom
feat/wear-payments
Open

jvsena42 wants to merge 33 commits into
masterfrom
feat/wear-payments

Conversation

@jvsena42

@jvsena42 jvsena42 commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Part of #2105
Source: team, #2105

Warning

Do not publish the Wear app until #2152 ships. The watch runs the same Spark wallet as the phone, and Spark real-time sync is off (realTimeSyncServerUrl = null), so two live instances share no state. Mainnet is also gated off in this build (Env.IS_MAINNET_ENABLED = false).

Stacked on #2177 (feat/wear-foundation). This PR adds payments to the Wear OS app (receive with a QR code, pay a payment link with hold to pay, recent activity, a balance Tile) and a self-send guard on the watch and the phone, so neither device pays an invoice its own wallet created.

Description

  • Adds a Receive page: an amountless Spark invoice as a full-brightness QR code that keeps the screen on only while shown, rests after 2 minutes, hides in ambient, replaces itself before it expires and turns into a check with a haptic when paid.
  • Adds a send flow from payment links, with the phone's schemes (bitcoin, BITCOIN, lightning, LIGHTNING, lnurl, lnurlp) plus spark; lnurlw and lnurlc are left out: Review, a 1.2 s hold on a bezel ring (a tap never pays; TalkBack gets a "Pay" action), then Sent, Pending or a one-line refusal. Not enough funds, expired invoices and own invoices are refused before the hold, and trying to pay offline ends on a dedicated "Can't pay offline" screen that drops the request, so it never pays later. The watch has no Send button.
  • Adds an Activity page with the last 20 payments and a detail screen.
  • Adds a balance Tile: the balance with a Receive button that opens the QR, a dimmed Bitkit mark while the wallet loads, and a Restore button when there is no wallet.
  • Adds a PaymentsRepo on the watch that parses links (bitkit-core, Breez for Spark addresses), prices and sends them. It never pays twice: send keys match the phone's SparkSendKey, every send is noted before it goes out, an outcome it cannot learn is reported as unknown rather than failed, and a retry reuses the same key after checking Spark's list.
  • Adds a self-send guard: the watch refuses invoices it created, Spark addresses with its own identity and invoices carrying its Spark address hint, and fails closed when it cannot tell. The phone's isOwnInvoice now also refuses the Spark invoices it created (QuickPay, scans and unified URIs), alongside the existing LDK node check.
  • Updates the pager order to Balance → Receive → Activity → Settings, and adds translations for every phone locale, screens-map rows, journeys and docs/wear.md.

Out of Scope

Design

N/A — no design available. #2105 is a prototype with no Figma; it follows Bitkit's colors, fonts and balance animation.

Preview

Large round (454 px, Wear OS 7) and small round (384 px, Wear OS 5) emulators, local ./spark stack, app commit fa2633955.

Receive QR Paid Paid in ambient Review (small)
Receive QR code Paid check with the amount Paid check without the amount in ambient Send review with hold to pay on the small watch
Ambient review Not enough funds Own invoice Activity
Send review hidden in ambient Not enough funds refusal with OK Own invoice refusal with OK Activity list

Tile (large round emulator):

Balance Loading No wallet Receive opens the QR
Tile with the balance and the Receive button Tile with the dimmed Bitkit mark while the wallet loads Tile with the Bitkit mark and Restore The app on the receive QR after tapping the tile's Receive

Offline error, and an uppercase LIGHTNING: link:

Offline Uppercase link
Can't pay offline with a crossed-out cloud and OK Review of an uppercase LIGHTNING link

Recordings (large round emulator):

  • Paying the Receive QR from the local stack:
receive-paid.mp4
  • Paying a lightning: link with hold to pay:
send-deeplink-bolt11.mp4
  • A tap and a short hold pay nothing:
send-hold-cancel.mp4
  • The watch refuses its own invoice:
send-own-invoice-guard.mp4
  • Tile: the balance, then Receive opens the QR:
tile-balance.mp4
  • Paying offline shows the offline error:
send-offline-error.mp4
  • Activity list and detail:
activity-list.mp4

QA Notes

Setup

  • Emulators as in feat: add wear os app foundation #2177 (Wear_Large_Round_API37, Wear_Small_Round_API34), installed with the local-stack build from journeys/wear/README.md › Local ./spark stack.
  • Backend: the local ./spark stack from bitkit-docker (spark-* services and bitcoind), so funds are ours. ./spark invoice <sats> makes an invoice for the watch to pay; ./spark pay <invoice> <sats> pays the watch.
  • Wallet: the public test phrase from feat: add wear os app foundation #2177; on the local chain it starts at 0 and J3 funds it.

Journeys

  • J1: new receive-qr.xml — the QR shows, ambient hides it, waking shows it again
  • J2: new receive-qr-rests.xml — the QR rests after 2 minutes and a tap shows it again
  • J3: new receive-paid.xml — paying the QR shows the check and amount; a tap gives a new invoice
  • J4: new send-deeplink-bolt11.xml — a lightning: link, Review, a 2 s hold, Sent, back to Balance
  • J5: new send-hold-cancel.xml — a tap and a short hold pay nothing
  • J6: new send-ambient-hides-amount.xml — ambient hides the amount on Review
  • J7: new send-insufficient.xml — too large an invoice is refused before the hold
  • J8: new send-own-invoice-guard.xml — the watch refuses its own invoice
  • J9: new activity-list.xml — payments listed with sign, amount and time; detail shows fee and status
  • J10: new receive-paid-ambient.xml — a payment in ambient shows the check without the amount
  • J11: updated journeys/send/own-invoice-guard.xml — the phone refuses its own Spark invoice (link and unified URI)
  • J12: new tile-balance.xml — the tile shows the balance, and Receive opens the app on the QR
  • J13: new send-offline-error.xml — a payment link opened offline shows the offline error, and nothing is paid once back online

Manual Tests

  • 1. On a physical watch with TalkBack on, open a payment link and use the "Pay" action from the actions menu → it pays once; a double tap alone pays nothing

Automated Checks

  • added PaymentsRepoTest.kt — parse, prepare and send; amount bounds, expiry, balance; one key per request across retries and restarts; unknown never read as failed; busy versus pending; wipe races
  • added SelfSendGuardTest.kt — own invoices, own Spark address and its hint, refusal when the guard cannot tell
  • added OwnInvoiceStoreTest.kt — bounded, pruned on expiry, cleared by the wipe
  • added UncertainSendStoreTest.kt — notes kept across restarts, settled, keyed by the payee's identity
  • added SparkSendKeyTest.kt — same derivation and test vector as the phone's
  • updated LaunchRequestTest.kt, PaymentsRepoTest.kt — every accepted scheme, uppercase BIP21 and bech32, lnurlp://, the excluded lnurlw/lnurlc
  • updated SendViewModelTest.kt — offline at arrival, while pricing and on Review; back online pays nothing
  • updated WatchSparkServiceTest.kt — receive, parse, send calls; send hold and disconnect grace
  • added ReceiveViewModelTest.kt, ReceiveQrContentTest.kt — invoice refresh and retry, paid check, ambient and rest states
  • added SendViewModelTest.kt, SendReviewTest.kt — review states, refusals before the hold, a tap never pays, TalkBack and long-click "Pay"
  • added ActivityViewModelTest.kt, ActivityNowSecsTest.kt — list reloads and relative times
  • added LaunchRequestTest.kt — payment links and the tile's Receive read from intents
  • added TileStateTest.kt — what the tile shows with no wallet, while loading, locked and ready
  • updated SparkServiceTest.kt, SparkRepoTest.kt, CacheStoreTest.kt, AppViewModelSendFlowTest.kt — the phone refuses its own Spark invoices (QuickPay scan, unified URI), fails closed on unreadable invoices and store errors

Evidence

  • Refusal screenshots retaken at 3c6d7477b (OK button instead of the check icon; local ./spark stack): send-insufficient.xml and send-own-invoice-guard.xml passed.
  • At c9ca8d108 (local ./spark stack, Wear_Large_Round_API37): J13 passed (screenshot and recording below); an uppercase LIGHTNING: invoice opened Review with ₿ 1 000; an lnurlp:// link showed "Invalid invoice" (fix: pay lud-17 lnurlp links on the phone and the watch #2190). Gate passed on c9ca8d108.
  • Tile, at 338e707f3: gate (just compile, just test, just lint) passed with strict dependency verification; the balance, loading, no-wallet and Receive screenshots and the J12 recording were taken on Wear_Large_Round_API37 against the local ./spark stack, and the tile switched from no wallet to the balance after a restore without being added again.
  • J3, J4, J5 and J8 were recorded again, and J12 recorded, at 338e707f3 (local ./spark stack); the first recordings of J3, J4, J5 and J8 had been cut before the recorder finished and did not play.
  • just deps recorded the eleven androidx tile entries but ended on a Maven Central 429 for Robolectric's nativeruntime-dist-compat jar, which was already recorded and is unchanged; the strict gate above confirms the metadata is complete.
  • Gate on the final code (16c56d832; later commits change docs only): just compile, just test, just lint all passed.
  • J1–J10 passed on Wear_Large_Round_API37 (Wear OS 7) at fa2633955 against the local ./spark stack. J4 sent 1 000 sats with a 6 sat fee and closed by itself; J5's tap and 0.5 s hold left the balance unchanged; J8 showed "Can't pay own invoice".
  • Fit check on Wear_Small_Round_API34 (Wear OS 5) at fa2633955: Receive, QR, Review, Activity and detail fit; only the "Hold to pay" label wraps to two lines (Preview).
  • Guard tests fail without the guard: with the watch guard forced off, 12 tests failed; with the phone's Spark check off, exactly its 6 new tests failed.
  • The SDK's idempotency handling for Spark-address transfers was checked against the Breez Spark SDK 0.28.3 source; the watch fails closed without relying on the operators refusing a reused transfer id.

Gaps

  • The tile was not captured on Wear_Small_Round_API34.
  • J11 (phone) was written from the code and not run on a phone.
  • Manual test 1 needs a physical watch with TalkBack; none was available. The TalkBack "Pay" action and long click are covered by SendReviewTest.kt only.
  • LNURL-pay and Lightning addresses have no journey (no Lightning address on the local stack); unit tests only.
  • The test wallet was not empty on the local chain at the start (earlier runs), so J9 also lists older payments.
  • On the small watch "Hold to pay" wraps to two lines in the edge button; the largest font scale was not checked.

Models used

  • Planning/scoping: claude-opus-5-5 (reasoning: medium)
  • Implementation: claude-fable-5-2 (reasoning: medium), claude-opus-5-5 (reasoning: medium)
  • Review: claude-fable-5-2 (reasoning: medium), claude-opus-5-5 (reasoning: medium)
  • Review rounds: 4
  • Journey runs: claude-sonnet-5-5 (reasoning: medium)

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Regtest APK

Built from 4f30db5 (run).

Download bitkit-dev-debug universal APK (expires in 30 days).

jvsena42 and others added 15 commits December 4, 2026 13:10
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…sends

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
jvsena42 and others added 12 commits December 4, 2026 13:10
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Like the balance read, an invoice or a send note was checked only for a
wipe in progress, so one that outlived a whole wipe and restore passed.
Both now carry the wipe token and are kept only while it is current.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jvsena42
jvsena42 marked this pull request as ready for review December 4, 2026 12:51
@jvsena42
jvsena42 requested review from a team, ben-kaufman and ovitrif and removed request for a team December 4, 2026 12:51
@greptile-apps

greptile-apps Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5RetriggerView in Greptile

[Critical impact] The PR adds a watch path for spending from the Spark wallet shared with the phone.

Fix the pending Spark-address retry path before merging; it can send a second payment.

Findings

  1. P1 Pending transfers can pay twice ▶
  2. P2 Security Locked tile retains balance ▶

Summary

Adds watch payments and a Spark self-send check on both devices:

  • The watch receives Spark payments and sends reviewed payment links.
  • The watch shows recent payments and their details.
  • The watch tile shows the balance and opens Receive.
  • The phone and watch recognize Spark invoices their wallet created.

Two issues remain: retrying a pending Spark-address transfer can send another payment, and the tile can retain the balance when a paused watch locks.

The stack assessment relies on the later code through PR #2207 for its process-wide send guard and pre-review paid-invoice checks; those protections are not all in this PR.

Acknowledged by jvsena42 and excluded: cross-device invoice/key sharing until pairing; settlement appearing pending after leaving the screen; unsupported lnurlp:// links (#2190); a stalled send keeping the wallet busy (#2184); non-atomic send hold/disconnect (#2185); expired invoices hiding an earlier unknown outcome (#2186); and duplicate activity instances under singleTop (#2187).

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Payment link] --> B[Parse and reject own invoices]
    B --> C[Price amount and fee]
    C --> D[Hold to pay]
    D --> E[Save send key]
    E --> F[Send through Spark]
    F --> G{Payment state}
    G --> H[Sent]
    G --> I[Pending]
    G --> J[Unknown outcome]
    I --> K[Retry must retain the same key]
Loading

Reviews (1) · Last reviewed commit: "fix: drop invoices and send notes that a..." · Reviewed by Greptile

@talosmachina talosmachina left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No findings. Adds Wear OS payments (receive QR, hold to pay from payment links, activity, a balance tile) and a self-send guard on the watch and the phone. Reviewed 5176962, oversized tier (100 files, about 8.9k lines over bd4bab2).

What I checked, and 6 candidates I ruled out

Read in full: PaymentsRepo.kt, SelfSendGuard.kt, SparkSendKey.kt (both copies), OwnInvoiceStore.kt, UncertainSendStore.kt, LaunchRequest.kt, the WatchSparkService.kt, MainActivity.kt and WearNavHost.kt diffs, the send path of SendViewModel.kt, rememberHoldToPayState, wear/src/main/AndroidManifest.xml, and the whole phone diff (CacheStore.kt, SparkRepo.kt, SparkService.kt, LightningRepo.kt, AppViewModel.kt)
Call sites traced: every phone isOwnInvoice() caller (scan, unified URI, QuickPay) and every sparkRepo.createInvoice caller (receive, LNURL withdraw, Paykit endpoints)
Not reviewed: the receive, send, activity and tile UI, the translations, docs, journeys and tests. This is what the oversized tier leaves out.
Not built here: static review. CI is the gate: the build check that shows red belongs to run 47338165667, which was cancelled when the newer CI run on this same head started. That newer run and Lint were still in progress when this was posted.

Ruled out

  • Phone and watch derive different send keys: the two SparkSendKey.key bodies differ only in fromHex() vs hexToByteArray(), the hash is the SDK's lowercase hex, and both seeds come from mnemonicToSeed.
  • Spark address hint never matches on the watch: 17592187092992000001 printed as block x tx x output is 16000000x16000000x1, the watch's constant.
  • A wipe leaves own invoices or send notes behind: both watch stores live in the settings DataStore that finishWipe clears; the phone's sparkOwnInvoices is in AppCacheData, reset by CacheStore.reset.
  • Two holds pay twice: onHoldComplete needs the Review step and send() leaves it synchronously; the repo's sendMutex.tryLock and the stalled-call check refuse a second send.
  • Phone guard fails open: an unreadable cache counts as own (getOrDefault(true)); only the Spark address check is skipped when Spark is down, and Bitkit's own invoices never carry that hint.
  • Exported surfaces: the VIEW filter only opens Review, which still needs the hold (skipConfirmation is false); the tile service is bound by BIND_TILE_PROVIDER only.

Merge confidence: 3/5, oversized tier: the UI, tile and tests were not read, so this is the ceiling.

Reviewer model: claude-opus-5-5
Reasoning effort: Not exposed (the reviewing session does not report it)

jvsena42 and others added 2 commits December 4, 2026 10:10
The note was dropped as soon as Spark took the transfer, so a retry of
one still pending after the wait found no note, went out under a new
key and paid twice. A transfer has no payment hash to find it by, so the
note now stays until Spark reports it completed or failed, and a retry
reads it there as in flight.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Locking a paused wallet leaves it paused, so the tile, which hid the
balance only for the locked status, kept showing it. The tile now reads
the watch's own lock state as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@ovi-reviewer ovi-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: ⛔️ Request changes — a failed initial wallet sync leaves the new payment screens loading indefinitely.

The PR moved to 7e3d2cd after this run; these results are for 5176962.

Findings:

  • MEDIUM — Handle failed startup before waiting for Ready. wear/src/main/java/to/bitkit/wear/ui/screens/send/SendViewModel.kt:91: a stored wallet whose first connection or sync fails enters WalletStatus.Error, rather than Offline. Send only handles Offline and waits exclusively for Ready, so a cold payment link stays on the loading ring. Reconnecting does not retry Error. The same missing failure handling occurs in ReceiveViewModel.create():139 (also reached by Tile Receive) and the initial load in ActivityViewModel:48–53. Expose a refusal or retry when startup fails. Two focused regressions against this commit confirmed Send remains Loading and Receive never exposes its error state; a device reproduction was not completed before the push.

QA for 5176962:

Receive QR hides in ambient ✅ Ambient hides the QR, and waking restores it.

j1-receive-ambient-2x.2x.mp4

Receive payment shows the amount ✅ Receiving 50,000 regtest sats shows the check and correct amount; tapping creates another invoice.

The invoice change was checked in device logs.

j3-receive-paid-2x.2x.mp4

A tap and short hold pay nothing ✅ Both leave Review open, and Back returns to the unchanged 50,000-sat balance.

The short hold lasted 500 ms.

j5-short-hold-2x.2x.mp4

Watch refuses its own invoice ✅ The own-invoice refusal appears before the hold, and OK returns to Receive.

j8-own-invoice-2x.2x.mp4

Phone refuses its own Spark invoice ✅ Both the Lightning link and full unified URI show “Cannot Pay Own Invoice” with empty Savings and QuickPay off.

The phone created the 1,000-sat invoice through Spark. The unified-URI guard message was checked in device logs. This covers the empty-Savings refusal; the funded onchain fallback and the QuickPay-enabled variant were not verified.

j11-phone-self-send-2x.2x.mp4

Hold to pay a Lightning link ⏭️ Not driven before the PR head changed.

Stopped at the reviewed commit after finishing the cases already recording.

Offline payment request is dropped ⏭️ Not driven before the PR head changed.

The warm offline/reconnect device case remains unverified in this run.

Cold launch with an offline payment link ⏭️ Device reproduction was not driven before the PR head changed.

The focused startup-failure regressions below exercised the failed state transition, rather than a device restart.

Check: startup failure handling ❌ Both focused regressions reproduce the retained finding.

With unchanged production code, a Connecting → Error transition leaves Send at Loading and Receive with isError=false. These checks were additional to the existing test suites.

Check: builds and existing automated checks ✅ Both apps build, and the affected unit suites and static checks pass.

Ran the Wear unit suite, the four affected phone test classes, and both modules’ Detekt and dev-debug lint checks. Both installed APKs were built from the reviewed commit with regtest fixture configuration.

Coverage: full bd4bab2..5176962 review, all 107 changed files and reached code. The PR moved to 7e3d2cd4 during testing; that push is outside this review. The pending-transfer and locked-tile findings already raised in other reviews are not repeated here; their claimed fixes belong to the later push.

Relied on the author’s recorded QA for unchanged rest/ambient presentation, insufficient-funds refusal, Activity and Tile interactions. Payment generation/wipe races, uncertain outcomes, LNURL amounts and key persistence were checked through source and unit tests, without a new device case for each. Mainnet and physical-watch behavior were outside this regtest run.

Twin: Android-only Wear work; no matching iOS PR found. The phone’s Spark own-invoice guard has no iOS counterpart in this PR.


Reviewed by gpt-6.1-sol-high

jvsena42 and others added 2 commits December 4, 2026 11:23
A wallet that cannot connect or sync in a fresh process ends in the
error status, which nothing retries by itself, while Send, Receive and
Activity waited only for Ready and loaded forever. Send now ends on its
offline refusal, Receive shows its error and its retry starts the wallet
again, and Activity shows the wallet error with a retry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jvsena42

jvsena42 commented Dec 4, 2026

Copy link
Copy Markdown
Member Author

Failed wallet start, driven at 56195b3

Wear_Large_Round_API37 emulator, hosted regtest. I restored the test wallet with Wi-Fi and data off, so the first start failed and the wallet went to WalletStatus.Error; Home showed "Couldn't load wallet".

Activity Receive Send (payment link) Receive after Retry, online
Activity shows the wallet error with a retry Receive shows its error with a retry Send ends on the offline refusal Receive shows a QR after the retry
  • Activity: WatchActivityError and WatchActivityRetry showed, instead of the loading ring.
  • Receive: WatchReceiveError showed at once.
  • Send: a lightning: link opened while the wallet was in error ended on "Can't pay offline" (WatchSendOfflineError) with OK.
  • Receive Retry, with the network back on: the retry started the wallet again. The first attempt's first sync timed out at 5 minutes on hosted regtest (Timed out on 'sync'), the same timeout seen on feat: add wear os app foundation #2177, and the screen went back to its error. A second Retry synced in 4 m 42 s and showed the QR.

@ovi-reviewer ovi-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: ⛔️ Request changes — a cold payment link remains loading after the wallet’s first sync fails.

The PR moved to 4f30db5 after this run; these results are for 7e3d2cd.

Reviewed 7e3d2cd. The PR moved to 4f30db5 during testing; the startup fix claimed in that newer push has not been reviewed here.

Reaudit: diff, six changed files plus the earlier open finding. No new delta findings; the pending-transfer and paused-lock fixes hold at this head.

Findings:

  • MEDIUM — Handle failed startup before waiting for Ready. Existing startup-error thread, now reproduced on-device. At wear/src/main/java/to/bitkit/wear/ui/screens/send/SendViewModel.kt:91, Send handles Offline but not Error, and start() waits only for Ready. A cold offline link stays on the loading ring after the initial sync fails. Restoring connectivity does not recover the screen; Back exposes Home’s error and retry. The same missing failure handling exists in ReceiveViewModel.create():139 and the initial load in ActivityViewModel:48–53. A refusal or retry is needed for startup errors. This finding applies to 7e3d2cd; the author’s later fix is outside this review.

QA for 7e3d2cd:

Tested on a small round Wear OS API 34 emulator with regtest funds. Recordings play at 2× speed.

Hold to pay a Lightning link ✅ Holding pays once, shows Sent, and returns to Balance.

A 2-second hold sent 1,000 sats. The balance changed from 50,000 to 48,994 sats, including a 6-sat fee. The receiver’s payment history independently confirms one successful inbound payment for this invoice.

j4-payment-2x.2x.mp4

SentUpdated balance
Offline payment request is dropped ✅ A warm offline link shows the dedicated refusal and cannot pay on reconnect.

The offline screen has OK and no hold action. After closing it and restoring connectivity, Home still shows 50,000 sats. The recovery was checked in the UI and wallet-sync logs after the recording.

j13-offline-2x.2x.mp4

Cold launch with an offline payment link ❌ A failed first sync leaves the payment screen loading after reconnect.

Cold-started the stored wallet offline with a payment link. Device logs confirm startup failed and the wallet entered Error. Restoring the network and reopening the link still left it loading. Back exposed Home’s error; its retry restored the wallet and a fresh link reached Review.

Cold offline launchAfter reconnect
c1-cold-offline-2x.2x.mp4
c1-reconnected-2x.2x.mp4
Locked watch hides the paused tile balance ✅ A paused, locked wallet produces a tile state without the balance.

A log-only tile-request hook confirmed Paused with the watch locked produces a null balance. The system lock screen covers the tile, so the locked rendering alone is not the proof; the request state and regression test verify it. After clearing the test lock, a fresh tile request and the visible tile both showed 50,000 sats again. No lock or payment logic changed in the diagnostic build.

Pause and lockUnlock
d1-locked-tile-2x.2x.mp4
d1-unlock-2x.2x.mp4
Phone refuses its own Spark invoice with QuickPay enabled ⏭️ Not driven before the head moved.

The phone was built and set up with QuickPay enabled and funded Savings. The push arrived while the watch payment case was in flight; this run finished that case and ended. The QuickPay-enabled guard and funded unified-URI fallback remain unverified. The earlier report only proves the QuickPay-off guard and empty-Savings refusal.

Check: pending-transfer retry protection ✅ The key survives a pending outcome and blocks a second send.

Source inspection and the added regression verify that a pending Spark-address transfer retains its key through settlement. Retrying consults the earlier transfer rather than generating a fresh payment key.

Check: startup failure handling ❌ Focused Send and Receive regressions reproduce the existing finding.

With unchanged production code, a Connecting → Error transition leaves Send at Loading and Receive without its error state.

Check: builds and existing automated checks ✅ Both apps build; the Wear unit suite and static checks pass.

Built both installed apps from the reviewed head with regtest configuration. Ran Wear unit tests, Detekt and dev-debug lint. Temporary diagnostic hooks were removed, and the pristine Wear app was rebuilt and reinstalled before the successful payment case.

Earlier evidence reused:

  • Previous review at 5176962: Receive QR ambient behavior, receipt and amount, tap/short-hold cancellation, the watch’s own-invoice refusal, and the phone’s QuickPay-off/empty-Savings guard. The delta leaves those paths unchanged.
  • Author’s recorded QA: unchanged QR rest, ambient Review, insufficient-funds refusal, Activity, paid-in-ambient behavior, and Tile Receive navigation. The changed tile lock state was checked again in this run.

Payment generation/wipe races and uncertain outcomes were checked through source and unit tests, without a separate device case for each. Mainnet and physical-watch behavior were outside this regtest run; LNURL-pay and Lightning addresses have unit coverage but no local Lightning-address fixture.

Twin: Android-only Wear work; no matching iOS PR found. The phone’s Spark own-invoice guard has no matching iOS change in this PR.


Reviewed by gpt-6.1-sol-high

This branch has not been deployed

No deployments
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.

2 participants