mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-06 07:34:21 +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:
@@ -239,9 +239,6 @@ void json_add_jsonstr(struct json_stream *js,
|
||||
{
|
||||
char *p;
|
||||
|
||||
if (!json_filter_ok(js->filter, fieldname))
|
||||
return;
|
||||
|
||||
/* NOTE: Filtering doesn't really work here! */
|
||||
if (!json_filter_ok(js->filter, fieldname))
|
||||
return;
|
||||
@@ -690,3 +687,11 @@ void json_add_lease_rates(struct json_stream *result,
|
||||
rates->channel_fee_max_proportional_thousandths);
|
||||
}
|
||||
|
||||
void json_add_id(struct json_stream *result, const char *id)
|
||||
{
|
||||
char *p;
|
||||
|
||||
/* Bypass escape-required assertion in json_out_add */
|
||||
p = json_member_direct(result, "id", strlen(id));
|
||||
memcpy(p, id, strlen(id));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user