ElementsProject / ElementsProject/lightning

How to reliably query payment status?

Open
#9,036 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
3.1k
Forks
1k
Avg merge
4d 10h
Merged PRs (30d)
13

Description

I have a lightning application that initiates payments using `xpay` over gRPC.
How can I reliably figure out the status of the payment.

## The problem with `listpays`

The problem is that `lispays` can transiently report `"failed"` while cln is still actively trying the payment. The status oscilates between `"pending"` and `"failed"` between individual route attempts.

We observed the issue on a lightning node and I created a [repro](https://github.com/ErikDeSmedt/lightning/tree/list-pays-bad-status) which yields the following results.

```
pending (x44) -> failed (x8) -> pending (x50) -> failed (x8) -> pending (x42) -> failed (x7) -> ... -> complete
```

A user who falsely believes that a payment has failed can run into danger.
- Eg: user tries another delivery method if lightning fails and end up paying twice
- Eg: when implementing swaps the user might revoke the incoming asset because the payment has failed

## The problem with waiting for a gRPC response

The `xpay` command returns once the payment is completed.
However, there is no guarantuee that we actually receive the response in case of network issues.

What should I do if this happens?
I don't want to call `listpays` because the payment might be marked as failed and end up succeeding.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.