Skip to content

Commit b906507

Browse files
wqxoxorustyrussell
authored andcommitted
Fix BOLT11 annotation loss after sendonion failure
Fixes #6978 where bolt11 annotations were lost when sendonion failed early and payment was retried. When sendonion RPC fails before saving payment to database, invstring_used flag would remain true, causing retry attempts to omit bolt11 parameter. Successful retries would then save to DB without bolt11 annotation. Move invstring_used flag setting from payment_createonion_success to payment_sendonion_success. This ensures the flag is only set after sendonion actually succeeds. The bolt11 will be sent with every sendonion attempt until the first successful one, accepting the minor redundancy for cleaner state management. Changelog-Fixed: Plugins: `listpays` can be missing the bolt11 information in some cases where `pay` is used.
1 parent ea0b804 commit b906507

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

plugins/libplugin-pay.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,6 +1702,11 @@ static struct command_result *payment_sendonion_success(struct command *cmd,
17021702
struct payment *p)
17031703
{
17041704
struct out_req *req;
1705+
struct payment *root = payment_root(p);
1706+
1707+
if (p->invstring)
1708+
root->invstring_used = true;
1709+
17051710
req = jsonrpc_request_start(payment_cmd(p), "waitsendpay",
17061711
payment_waitsendpay_finished,
17071712
payment_waitsendpay_finished, p);
@@ -1764,8 +1769,6 @@ static struct command_result *payment_createonion_success(struct command *cmd,
17641769

17651770
if (p->description)
17661771
json_add_string(req->js, "description", p->description);
1767-
1768-
root->invstring_used = true;
17691772
}
17701773

17711774
if (p->pay_destination)

0 commit comments

Comments
 (0)