Skip to content

Commit 40eaa38

Browse files
committed
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, the invstring_used flag remained true, causing retry attempts to omit the bolt11 parameter. Successful retries would then save to DB without bolt11 annotation. The bug is visible in payment_createonion_success() (line 1772): flag is set before sendonion RPC completes. If sendonion fails immediately (e.g., no peer connection), flag remains true and retries omit bolt11. Fix: Reset invstring_used=false in payment_rpc_failure() when method is "sendonion", ensuring retry attempts include bolt11.
1 parent 0cabd46 commit 40eaa38

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

plugins/libplugin-pay.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,11 @@ static struct command_result *payment_rpc_failure(struct command *cmd,
221221
const jsmntok_t *toks,
222222
struct payment *p)
223223
{
224+
struct payment *root = payment_root(p);
225+
226+
if (streq(method, "sendonion"))
227+
root->invstring_used = false;
228+
224229
return payment_fail(p,
225230
"Failing a partial payment due to a failed RPC call %s: %.*s",
226231
method, toks->end - toks->start, buffer + toks->start);

0 commit comments

Comments
 (0)