mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
pay: Do not replay results against payments that were not suspended
Suspended payments now have the same groupid as the actual attempt, this allows us to identify pay calls that were suspended due to us and terminate only those. Changelog-Fixed pay: Fixed a crash when `pay` was called multiple times while an attempt was already in progress.
This commit is contained in:
committed by
neil saitug
parent
aca9c7d49c
commit
093933b14d
@@ -589,7 +589,12 @@ static void on_payment_success(struct payment *payment)
|
||||
* `payment_finished`. */
|
||||
if (payment == p)
|
||||
continue;
|
||||
if (!sha256_eq(payment->payment_hash, p->payment_hash))
|
||||
|
||||
/* Both groupid and payment_hash must match. This is
|
||||
* because when we suspended the payment itself, we
|
||||
* set the groupid to match. */
|
||||
if (!sha256_eq(payment->payment_hash, p->payment_hash) ||
|
||||
payment->groupid != p->groupid)
|
||||
continue;
|
||||
if (p->cmd == NULL)
|
||||
continue;
|
||||
@@ -675,7 +680,11 @@ static void on_payment_failure(struct payment *payment)
|
||||
* `payment_finished`. */
|
||||
if (payment == p)
|
||||
continue;
|
||||
if (!sha256_eq(payment->payment_hash, p->payment_hash))
|
||||
|
||||
/* When we suspended we've set the groupid to match so
|
||||
* we'd know which calls were duplicates. */
|
||||
if (!sha256_eq(payment->payment_hash, p->payment_hash) ||
|
||||
payment->groupid != p->groupid)
|
||||
continue;
|
||||
if (p->cmd == NULL)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user