Skip to content

Tighten LNURLw withdraw callback and timeout handling - #586

Merged
m1sterc001guy merged 1 commit into
fedimint:masterfrom
NateMoeller:fix/lnurlw-withdraw-confirmation
Oct 5, 2026
Merged

m1sterc001guy merged 1 commit into
fedimint:masterfrom
NateMoeller:fix/lnurlw-withdraw-confirmation

Conversation

@NateMoeller

Copy link
Copy Markdown
Contributor
  • The withdraw callback now succeeds only on an explicit {"status":"OK"}. Any non-2xx or unexpected reply fails right away instead of waiting on a payment that was never sent. It reuses fetch_json for HTTP status and LUD-06 error handling.
  • The receive wait drops from 5 minutes to 1. On timeout the user is told the payment is still pending, not that it failed: the receive keeps running, so a late payment still reaches the balance.

Found while testing LNbits vouchers on iOS: payments that stalled in flight showed "Withdraw failed" after 5 minutes even though they could still settle.

Only treat an explicit {"status":"OK"} from the withdraw callback as
success, so a non-2xx or unexpected reply fails immediately instead of
waiting for a payment that was never sent.

Cut the receive wait to 1 minute and, on timeout, tell the user the
payment is still pending rather than failed: the receive keeps running
and a late payment still lands in the balance.
/// Anything else — `{}`, a proxy's `{"detail": ...}`, a rate limiter's body — must
/// fail here, or the caller waits out its receive timeout for a payment nobody
/// sent. Errors and non-2xx statuses are already rejected by [`fetch_json`].
fn check_withdraw_callback_response(resp: &serde_json::Value) -> anyhow::Result<()> {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should probably implement this in rust, not dart

@m1sterc001guy
m1sterc001guy merged commit 442a74b into fedimint:master Oct 5, 2026
7 checks passed
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