Skip to content

fix(wallet): handle unpaid invoices in the CLI invoice command#1022

Open
edgarmuyomba wants to merge 1 commit into
cashubtc:mainfrom
edgarmuyomba:fix/invoice-unpaid-handling
Open

fix(wallet): handle unpaid invoices in the CLI invoice command#1022
edgarmuyomba wants to merge 1 commit into
cashubtc:mainfrom
edgarmuyomba:fix/invoice-unpaid-handling

Conversation

@edgarmuyomba

@edgarmuyomba edgarmuyomba commented May 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #1021

Summary

  • Added timeout to websocket wait loop using mint quote expiry, preventing indefinite hang when invoice is never paid
  • Put "Invoice paid" output behind paid state check so it only prints when minting actually succeeded

Testing

Tested by setting fakewallet_brr=False to disable auto invoice payment, then running cashu invoice 99 and waiting ~10 minutes.
Console correctly output "Invoice is not paid yet, stopping check..." with no misleading "Invoice paid" message.

Fixes cashubtc#1021

- Add timeout to websocket wait loop using mint quote expiry,
  preventing indefinite hang when invoice is never paid
- Guard "Invoice paid" output behind paid state check so it
  only prints when minting actually succeeded
@github-project-automation github-project-automation Bot moved this to Backlog in nutshell May 27, 2026
@edgarmuyomba edgarmuyomba changed the title [Wallet] fix: handle unpaid invoices in the CLI invoice command fix(wallet): handle unpaid invoices in the CLI invoice command May 30, 2026
@b-l-u-e

b-l-u-e commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Faced similar issue
Nice PR will review it today

@b-l-u-e

b-l-u-e commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Tested locally and confirmed

  • cashu invoice no longer blocks indefinitely in the websocket wait loop when the quote stays unpaid (bounded by quote expiry or the existing 5‑minute fallback).
  • It no longer prints misleading Invoice paid. when payment never completed.
  • The wallet calls subscription.close() and exits cleanly after stopping the check.

Test setup: local mint with websocket support, unpaid invoice (e.g. FAKEWALLET_BRR=false), cashu invoice <amount> with websocket polling enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

[Wallet] CLI invoice command: misleading "Invoice paid" output + indefinite websocket hang on unpaid invoices

2 participants