listsendpays: discriminate ongoing payment by groupid
Some checks failed
Continuous Integration / Pre-build checks (push) Waiting to run
Continuous Integration / Build compile-clang-sanitizers (push) Blocked by required conditions
Continuous Integration / Build compile-clang (push) Blocked by required conditions
Continuous Integration / Build compile-gcc (push) Blocked by required conditions
Continuous Integration / Build compile-gcc-O1 (push) Blocked by required conditions
Continuous Integration / Build compile-gcc-O3 (push) Blocked by required conditions
Continuous Integration / check-compiled-source (compile-gcc) (push) Blocked by required conditions
Continuous Integration / Run unit tests (push) Blocked by required conditions
Continuous Integration / Run unit tests-1 (push) Blocked by required conditions
Continuous Integration / Build 32-bit (size_t != 64-bit warnings) (push) Blocked by required conditions
Continuous Integration / Run fuzz regression tests (push) Blocked by required conditions
Continuous Integration / Check we can downgrade the node (push) Blocked by required conditions
Continuous Integration / Check we can downgrade the node-1 (push) Blocked by required conditions
Continuous Integration / Check we can downgrade the node-2 (push) Blocked by required conditions
Continuous Integration / First Integration Tests (1/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (2/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (3/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (4/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (5/6) (push) Blocked by required conditions
Continuous Integration / First Integration Tests (6/6) (push) Blocked by required conditions
Continuous Integration / Test CLN dual-fund Full Integration (push) Blocked by required conditions
Continuous Integration / Test CLN liquid Full Integration (push) Blocked by required conditions
Continuous Integration / Test CLN postgres Full Integration (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (1/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (10/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (11/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (12/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (2/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (3/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (4/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (5/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (6/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (7/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (8/12) (push) Blocked by required conditions
Continuous Integration / Valgrind Test CLN (9/12) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (1/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (2/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (3/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (4/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (5/6) (push) Blocked by required conditions
Continuous Integration / ASan/UBSan (6/6) (push) Blocked by required conditions
Continuous Integration / Update examples in doc schemas (disabled temporarily!) (push) Blocked by required conditions
Continuous Integration / Test minimum supported BTC v25.0 with clang (push) Blocked by required conditions
Continuous Integration / CI completion (push) Blocked by required conditions
Release Rust 🦀 / release_rust (push) Waiting to run
ReadMe Sync / rdme-docs-sync (push) Has been cancelled

A payment attempt in listpays is defined as pair (payment hash, group id).
If we query xpay for ongoing payments we must discriminate
using both values.

Fixes flaky test tests/test_pay.py:test_sendpay_grouping
```
FAILED tests/test_pay.py::test_sendpay_grouping - AssertionError: assert ['pending', 'pending', 'complete'] == ['failed', 'failed', 'complete']
```

Changelog-None

Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
This commit is contained in:
Lagrang3 2026-06-22 08:29:28 +01:00 committed by Dusty Daemon
parent c17a48fa81
commit aaefc60f1b
3 changed files with 8 additions and 4 deletions

View file

@ -159,7 +159,8 @@ static void add_new_entry(struct plugin *plugin,
if (pm->state & PAYMENT_COMPLETE)
json_add_string(ret, "status", "complete");
else if (pm->state & PAYMENT_PENDING || attempt_ongoing(plugin, pm->payment_hash))
else if (pm->state & PAYMENT_PENDING ||
attempt_ongoing(plugin, pm->payment_hash, pm->sortkey.groupid))
json_add_string(ret, "status", "pending");
else
json_add_string(ret, "status", "failed");

View file

@ -2510,13 +2510,15 @@ static struct payment *new_payment(const tal_t *ctx,
return payment;
}
bool attempt_ongoing(struct plugin *plugin, const struct sha256 *payment_hash)
bool attempt_ongoing(struct plugin *plugin, const struct sha256 *payment_hash,
u64 groupid)
{
struct xpay *xpay = xpay_of(plugin);
const struct payment *payment;
list_for_each(&xpay->payments, payment, list) {
if (sha256_eq(&payment->payment_hash, payment_hash))
if (sha256_eq(&payment->payment_hash, payment_hash) &&
payment->group_id == groupid)
return true;
}
return false;

View file

@ -7,6 +7,7 @@ struct plugin;
struct sha256;
/* Are we still attempting this payment? If so, we won't list is as failed. */
bool attempt_ongoing(struct plugin *plugin, const struct sha256 *payment_hash);
bool attempt_ongoing(struct plugin *plugin, const struct sha256 *payment_hash,
u64 groupid);
#endif /* LIGHTNING_PLUGINS_XPAY_XPAY_H */