Repository navigation
Conversation
Regtest APKDownload bitkit-dev-debug universal APK (expires in 30 days). |
c9ca8d1 to
3c6d747
Compare
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>
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>
3c6d747 to
079208e
Compare
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>
Confidence Score: 4/5
[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. FindingsSummaryAdds watch payments and a Spark self-send check on both devices:
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 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]
Reviews (1) · Last reviewed commit: "fix: drop invoices and send notes that a..." · Reviewed by Greptile |
talosmachina
left a comment
There was a problem hiding this comment.
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.keybodies differ only infromHex()vshexToByteArray(), the hash is the SDK's lowercase hex, and both seeds come frommnemonicToSeed. - Spark address hint never matches on the watch:
17592187092992000001printed as block x tx x output is16000000x16000000x1, the watch's constant. - A wipe leaves own invoices or send notes behind: both watch stores live in the settings DataStore that
finishWipeclears; the phone'ssparkOwnInvoicesis inAppCacheData, reset byCacheStore.reset. - Two holds pay twice:
onHoldCompleteneeds the Review step andsend()leaves it synchronously; the repo'ssendMutex.tryLockand 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 (
skipConfirmationis false); the tile service is bound byBIND_TILE_PROVIDERonly.
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)
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>
There was a problem hiding this comment.
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 entersWalletStatus.Error, rather thanOffline. Send only handlesOfflineand waits exclusively forReady, so a cold payment link stays on the loading ring. Reconnecting does not retryError. The same missing failure handling occurs inReceiveViewModel.create():139(also reached by Tile Receive) and the initial load inActivityViewModel:48–53. Expose a refusal or retry when startup fails. Two focused regressions against this commit confirmed Send remainsLoadingand 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
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>
Failed wallet start, driven at 56195b3
|
There was a problem hiding this comment.
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 handlesOfflinebut notError, andstart()waits only forReady. 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 inReceiveViewModel.create():139and the initial load inActivityViewModel: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
| Sent | Updated 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 launch | After 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 lock | Unlock |
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






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
bitcoin,BITCOIN,lightning,LIGHTNING,lnurl,lnurlp) plusspark;lnurlwandlnurlcare 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.PaymentsRepoon the watch that parses links (bitkit-core, Breez for Spark addresses), prices and sends them. It never pays twice: send keys match the phone'sSparkSendKey, 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.isOwnInvoicenow also refuses the Spark invoices it created (QuickPay, scans and unified URIs), alongside the existing LDK node check.docs/wear.md.Out of Scope
wear/app: an unpaired watch does not know the phone's invoices (and the reverse), and the two cannot share Spark-address send keys, until the pairing PR. Documented indocs/wear.md› Self-send guard and Payments.wear: QuickPay (skip the hold under the limit) comes with the settings import PR;skipConfirmationis the one hook for it and returns false here.wear: LNURL-pay and Lightning addresses are unit-tested only; the local stack has no Lightning address to pay.wear: if the app leaves the screen during the 60 s settlement wait, a payment that completed shows as Pending until Activity reloads. Documented.wear/app: LUD-17lnurlp://host/pathlinks are not read by bitkit-core on either app; the bech32 forms work — fix: pay lud-17 lnurlp links on the phone and the watch #2190wearpayments: a send call that never returns keeps the wallet busy across disconnect, wipe and restore — fix: end a stalled wear spark send with its connection #2184wearpayments: make the send hold and the Spark disconnect atomic — fix: make the wear send hold and spark disconnect atomic #2185wearpayments: an invoice that expired after an unknown send reads as plainly expired — fix: show a possible earlier payment for an expired wear invoice #2186wearapp:singleToplets a link started withoutNEW_TASKopen a secondMainActivityin the caller's task — fix: keep wear payment links in one bitkit task #2187Design
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
./sparkstack, app commitfa2633955.Tile (large round emulator):
Offline error, and an uppercase
LIGHTNING:link:Recordings (large round emulator):
receive-paid.mp4
lightning:link with hold to pay:send-deeplink-bolt11.mp4
send-hold-cancel.mp4
send-own-invoice-guard.mp4
tile-balance.mp4
send-offline-error.mp4
activity-list.mp4
QA Notes
Setup
Wear_Large_Round_API37,Wear_Small_Round_API34), installed with the local-stack build fromjourneys/wear/README.md› Local./sparkstack../sparkstack from bitkit-docker (spark-*services andbitcoind), so funds are ours../spark invoice <sats>makes an invoice for the watch to pay;./spark pay <invoice> <sats>pays the watch.Journeys
receive-qr.xml— the QR shows, ambient hides it, waking shows it againreceive-qr-rests.xml— the QR rests after 2 minutes and a tap shows it againreceive-paid.xml— paying the QR shows the check and amount; a tap gives a new invoicesend-deeplink-bolt11.xml— alightning:link, Review, a 2 s hold, Sent, back to Balancesend-hold-cancel.xml— a tap and a short hold pay nothingsend-ambient-hides-amount.xml— ambient hides the amount on Reviewsend-insufficient.xml— too large an invoice is refused before the holdsend-own-invoice-guard.xml— the watch refuses its own invoiceactivity-list.xml— payments listed with sign, amount and time; detail shows fee and statusreceive-paid-ambient.xml— a payment in ambient shows the check without the amountjourneys/send/own-invoice-guard.xml— the phone refuses its own Spark invoice (link and unified URI)tile-balance.xml— the tile shows the balance, and Receive opens the app on the QRsend-offline-error.xml— a payment link opened offline shows the offline error, and nothing is paid once back onlineManual Tests
Automated Checks
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 racesSelfSendGuardTest.kt— own invoices, own Spark address and its hint, refusal when the guard cannot tellOwnInvoiceStoreTest.kt— bounded, pruned on expiry, cleared by the wipeUncertainSendStoreTest.kt— notes kept across restarts, settled, keyed by the payee's identitySparkSendKeyTest.kt— same derivation and test vector as the phone'sLaunchRequestTest.kt,PaymentsRepoTest.kt— every accepted scheme, uppercase BIP21 and bech32,lnurlp://, the excludedlnurlw/lnurlcSendViewModelTest.kt— offline at arrival, while pricing and on Review; back online pays nothingWatchSparkServiceTest.kt— receive, parse, send calls; send hold and disconnect graceReceiveViewModelTest.kt,ReceiveQrContentTest.kt— invoice refresh and retry, paid check, ambient and rest statesSendViewModelTest.kt,SendReviewTest.kt— review states, refusals before the hold, a tap never pays, TalkBack and long-click "Pay"ActivityViewModelTest.kt,ActivityNowSecsTest.kt— list reloads and relative timesLaunchRequestTest.kt— payment links and the tile's Receive read from intentsTileStateTest.kt— what the tile shows with no wallet, while loading, locked and readySparkServiceTest.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 errorsEvidence
3c6d7477b(OK button instead of the check icon; local./sparkstack):send-insufficient.xmlandsend-own-invoice-guard.xmlpassed.c9ca8d108(local./sparkstack,Wear_Large_Round_API37): J13 passed (screenshot and recording below); an uppercaseLIGHTNING:invoice opened Review with ₿ 1 000; anlnurlp://link showed "Invalid invoice" (fix: pay lud-17 lnurlp links on the phone and the watch #2190). Gate passed onc9ca8d108.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 onWear_Large_Round_API37against the local./sparkstack, and the tile switched from no wallet to the balance after a restore without being added again.338e707f3(local./sparkstack); the first recordings of J3, J4, J5 and J8 had been cut before the recorder finished and did not play.just depsrecorded the eleven androidx tile entries but ended on a Maven Central 429 for Robolectric'snativeruntime-dist-compatjar, which was already recorded and is unchanged; the strict gate above confirms the metadata is complete.16c56d832; later commits change docs only):just compile,just test,just lintall passed.Wear_Large_Round_API37(Wear OS 7) atfa2633955against the local./sparkstack. 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".Wear_Small_Round_API34(Wear OS 5) atfa2633955: Receive, QR, Review, Activity and detail fit; only the "Hold to pay" label wraps to two lines (Preview).Gaps
Wear_Small_Round_API34.SendReviewTest.ktonly.Models used
claude-opus-5-5(reasoning:medium)claude-fable-5-2(reasoning:medium),claude-opus-5-5(reasoning:medium)claude-fable-5-2(reasoning:medium),claude-opus-5-5(reasoning:medium)claude-sonnet-5-5(reasoning:medium)🤖 Generated with Claude Code