ElementsProject / ElementsProject/lightning

Delayed status updates with `pay` and `listpays` (gRPC)

Open
#6,327 2 comments 0 reactions 0 assignees View on GitHub
discussion in diagnostic
Dominant language
C
Stars
3.1k
Forks
1k
Avg merge
4d 10h
Merged PRs (30d)
13

Description

Currently observed this behaviour while testing an application that sends out payments via `pay` (gRPC) and another service polling these payments via `listpays` (gRPC). There is a rather long delay before `listpays` reports the correct state after the `pay` request either returns `COMPLETE` or `FAILED`.

Initiating he `pay` request:
```
2023-06-12T08:39:08.724Z WARN: Payment '70ab8e36814...' with amount '16777215001 msat' resulted in error: UNKNOWN: Error calling method Pay: RpcError { code: Some(210), message: "Ran out of routes to try after 31 attempts: see `paystatus`" }
```
Subequently polling the `listpays` gRPC endpoint, which will report `PENDING` for more than 70 seconds.
```
2023-06-12T08:39:09.699Z DEBUG: Checking payment 70ab8e36814… resulted in: PENDING.
2023-06-12T08:39:10.761Z DEBUG: Checking payment 70ab8e36814… resulted in: PENDING.
2023-06-12T08:39:11.833Z DEBUG: Checking payment 70ab8e36814… resulted in: PENDING.
[...] # polling every second (same output)
2023-06-12T08:40:18.181Z DEBUG: Checking payment 70ab8e36814… resulted in: PENDING.
2023-06-12T08:40:19.194Z DEBUG: Checking payment 70ab8e36814… resulted in: PENDING.
2023-06-12T08:40:20.228Z INFO: Checking payment 70ab8e36814… resulted in: FAILED.
```

It is not big issue per se, rather an inconvenience (albeit it has real impact on UX). If this could be somehow configured, it would also massively speed up the test suite runs. I tried a few things, but to no avail.. e.g. reducing `retry_for` to a small number (i.e. 2 seconds) does not influence the delay.

The docs say:
> You can monitor the progress and retries of a payment using the lightning-paystatus(7) command.

However, `paystatus` does not seem to be exposed via gRPC..

Any ideas? Is there a way to speed things up?
Any and all feedback is highly appreciated :pray:

Edit: Same happened for successful payments in previous versions, but with v23.05, it seems to update the state to `COMPLETE` quite quickly :rocket: (However, I might just have been lucky a few times?)

### Issue and Steps to Reproduce
1. Initiate a payment via `pay` gRPC endpoint (e.g. one that is definitely failing)
2. Watch `pay` reporting the payment as `FAILED`
3. Start polling `listpays`
4. Watch `listpays` return `PENDING` for quite a while
5. Wait till `listpays` reports the payment as `FAILED`

### `getinfo` output
Using CLN v23.05 on `regtest`:
```
$ lightning-cli --network=regtest getinfo
{
"id": "0213c5927a0045bcf53c3c8ea04cf3e230ee3f066ca6ea3b2fcce95e8da471d191",
"alias": "cln1-integration-test",
"color": "0213c5",
"num_peers": 1,
"num_pending_channels": 0,
"num_active_channels": 1,
"num_inactive_channels": 0,
"address": [],
"binding": [
{
"type": "ipv6",
"address": "::",
"port": 19846
},
{
"type": "ipv4",
"address": "0.0.0.0",
"port": 19846
}
],
"version": "v23.05",
"blockheight": 123,
"network": "regtest",
"fees_collected_msat": 0,
"lightning-dir": "/home/clightning/.lightning/regtest",
"our_features": {
"init": "08a0000a0269a2",
"node": "88a0000a0269a2",
"channel": "",
"invoice": "02000002024100"
}
}
```

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.