mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-04 14:54:26 +01:00
fix(jsonrpc): trim the lightning: prefix from invoice
Previously, our code checked for the presence of the `lightning:`
prefix while decoding a bolt11 string. Although this prefix is valid
and accepted by the core lightning pay command, it was causing issues
with how we managed invoices. Specifically, we were skipping the prefix
when creating a copy of the invoice string and storing the raw invoice
(including the prefix) in the database, which caused inconsistencies
in the user experience.
To address this issue, we need to strip the `lightning:` prefix before
calling each core lightning command. In addition, we should
modify the invstring inside the db with the canonical one.
This commit fixes the issue by stripping the `lightning:` prefix
from the `listsendpays` function, which will improve the
user experience and ensure consistency in our invoice management (see
next commit).
Reported-by: @johngribbin
Link: ElementsProject#6207
Fixes: debbdc0
Changelog-Fixes: trim the `lightning:` prefix from invoice everywhere.
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
e366c19d09
commit
5f6642a6ff
@@ -440,6 +440,15 @@ struct command_result *param_string(struct command *cmd, const char *name,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct command_result *param_invstring(struct command *cmd, const char *name,
|
||||
const char * buffer, const jsmntok_t *tok,
|
||||
const char **str)
|
||||
{
|
||||
const char *strtmp = json_strdup(cmd, buffer, tok);
|
||||
*str = to_canonical_invstr(cmd, strtmp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct command_result *param_ignore(struct command *cmd, const char *name,
|
||||
const char *buffer, const jsmntok_t *tok,
|
||||
const void *unused)
|
||||
|
||||
Reference in New Issue
Block a user