Repository navigation
Description
What happened?
Cancelling a hardware-wallet signature for an incoming Paykit payment request leaves the request stuck. The payer keeps showing the request as being paid, and the requester waits forever for a payment that will never arrive.
AppViewModel.prepareHardwareContactPayment() (app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt:4345) accepts the payment request and consumes the private payment list before the Trezor is asked to sign. When the user then declines on the device, onHardwareSignCancelled() (AppViewModel.kt:4365) only flips isSubmittingPaymentRequest = false:
fun onHardwareSignCancelled() {
isSubmittingPaymentRequest = false
}Nothing tells the proof side that the started on-chain payment failed, so the accepted request is never rolled back.
Dismissing the Send sheet mid-sign is worse: hideSheet() never calls onHardwareSignCancelled() at all, so it takes the same path with no cleanup whatsoever.
Expected behavior
Cancelling on the device — or dismissing the sheet while the hardware signature is pending — should fail the started payment proof, so the request returns to an actionable state on both sides.
Steps to Reproduce
- Enable Paykit (Dev Settings toggle) on two devices and pair them as contacts.
- Pair a Trezor on the payer.
- On the payee: drawer → REQUESTS → Request Payment → pick the payer → Send Request.
- On the payer: drawer → REQUESTS → Show Details → set FROM to the Trezor wallet → Swipe To Pay.
- On the hardware-sign screen, decline the signature on the Trezor (or dismiss the sheet).
- The request stays in its accepted/paying state; the requester never sees a rejection.
Additional context
- Scope: only reachable when Paykit payment requests are enabled, and only for the hardware funding source. Regular (non-HW) sends unwind correctly.
- A fix already exists but is not on
master: commitae762113f("fix: clean up cancelled hardware payments") on branchcodex/paykit-subscriptions-android(PR feat: add Paykit subscriptions #1186). It addsPaykitPaymentProofRepo.failOnchainPayment, routes bothonHardwareSignCancelled()and thehideSheet()path through a sharedcancelHardwarePaymentRequestIfNeeded(), and covers both with tests inAppViewModelSendFlowTest.kt. Either land feat: add Paykit subscriptions #1186 or cherry-pick that commit. - Found while reviewing
master(452757987) for release readiness.
🤖 Generated with Claude Code
Activity
jvsena42 commentedon Sep 15, 2026
Fixed in
master(cc1023ac).AppViewModel.onHardwareSignCancelled()now calls a sharedcancelHardwarePaymentRequestIfNeeded()helper, which resolves the active contact-payment context (guarded onhardwareWalletId != null) and callspaykitPaymentProofRepo.failOnchainPayment(request)inside atry/finallythat resetsisSubmittingPaymentRequest. The dismiss path is covered too:hideSheetinvokes the same helper when the current sheet isSheet.Send. So both declining on the device and swiping the sheet away release the request instead of leaving it stuck.Already covered by
AppViewModelSendFlowTest:cancelling hardware signing fails the started payment proofdismissing hardware signing fails the started payment proofboth asserting
verify(paykitPaymentProofRepo).failOnchainPayment(request), with negative cases asserting it is not called for non-hardware sends.No new test added in #1274 — the existing assertions already pin it.
Not re-verified end-to-end on the emulator: that needs two paired Paykit devices plus a Trezor on the payer side. Closing on the code plus the existing test coverage; reopen if the stuck state still shows up in practice.