lightningd: unescape JSON strings for db.

We were feeding in the raw JSON, which escapes \".  Then we were
escaping *again* to return it.

Reported-by: @m-schmook
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Fixed: JSON-RPC: `datastore` handles escapes in `string` parameter correctly.
This commit is contained in:
Rusty Russell
2023-02-11 12:03:56 +10:30
committed by Alex Myers
parent 15a744be8c
commit 9a77a995a8

View File

@@ -136,7 +136,7 @@ static struct command_result *json_datastore(struct command *cmd,
if (!param(cmd, buffer, params,
p_req("key", param_list_or_string, &key),
p_opt("string", param_string, &strdata),
p_opt("string", param_escaped_string, &strdata),
p_opt("hex", param_bin_from_hex, &data),
p_opt_def("mode", param_mode, &mode, DS_MUST_NOT_EXIST),
p_opt("generation", param_u64, &generation),