Skip to content

Commit

Permalink
Fix payment stuck on sender error
Browse files Browse the repository at this point in the history
We want to await the invoice poll promise so we can check for receiver errors, but in case of sender errors, the promise will never settle.
  • Loading branch information
ekzyis committed Dec 10, 2024
1 parent e99ea08 commit c08441d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion wallets/payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '@/wallets/errors'
import { canSend } from './common'
import { useWalletLoggerFactory } from './logger'
import { withTimeout } from '@/lib/time'

export function useWalletPayment () {
const wallets = useSendWallets()
Expand Down Expand Up @@ -53,7 +54,8 @@ export function useWalletPayment () {
try {
// we always await the poll promise here to check for failed forwards since sender wallet errors
// can be caused by them which we want to handle as receiver errors, not sender errors.
await pollPromise
// but we don't wait forever because real sender errors will cause the poll promise to never settle.
await withTimeout(pollPromise, FAST_POLL_INTERVAL * 2.5)
} catch (err) {
if (err instanceof WalletError) {
paymentError = err
Expand Down

0 comments on commit c08441d

Please sign in to comment.