mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
libplugin: don't turn non-string JSON ids into strings.
When called with `"id": 1` we replied with `"id": "1"`. lightningd doesn't actually care, but it's weird. Copy the entire token: this way we don't have to special case anything. Also, remove the doubled test in json_add_jsonstr. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -206,7 +206,9 @@ const char *json_get_id(const tal_t *ctx,
|
||||
const jsmntok_t *idtok = json_get_member(buffer, obj, "id");
|
||||
if (!idtok)
|
||||
return NULL;
|
||||
return json_strdup(ctx, buffer, idtok);
|
||||
return tal_strndup(ctx,
|
||||
json_tok_full(buffer, idtok),
|
||||
json_tok_full_len(idtok));
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user