Skip to content

Commit a11b5e6

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 0cabd46 commit a11b5e6

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
@@ -1703,6 +1703,11 @@ static struct command_result *payment_sendonion_success(struct command *cmd,
17031703
struct payment *p)
17041704
{
17051705
struct out_req *req;
1706+
struct payment *root = payment_root(p);
1707+
1708+
if (p->invstring)
1709+
root->invstring_used = true;
1710+
17061711
req = jsonrpc_request_start(payment_cmd(p), "waitsendpay",
17071712
payment_waitsendpay_finished,
17081713
payment_waitsendpay_finished, p);
@@ -1765,8 +1770,6 @@ static struct command_result *payment_createonion_success(struct command *cmd,
17651770

17661771
if (p->description)
17671772
json_add_string(req->js, "description", p->description);
1768-
1769-
root->invstring_used = true;
17701773
}
17711774

17721775
if (p->pay_destination)

0 commit comments

Comments
 (0)