Browse Source

common/json: add a json helper for the new errcode type

travis-debug
darosior 5 years ago
committed by Rusty Russell
parent
commit
e6f56765ca
  1. 6
      common/json.c
  2. 4
      common/json.h

6
common/json.c

@ -762,3 +762,9 @@ void json_add_tok(struct json_stream *result, const char *fieldname,
}
abort();
}
void json_add_errcode(struct json_stream *result, const char *fieldname,
errcode_t code)
{
json_add_member(result, fieldname, false, "%"PRIerrcode, code);
}

4
common/json.h

@ -264,5 +264,9 @@ void json_add_preimage(struct json_stream *result, const char *fieldname,
void json_add_tok(struct json_stream *result, const char *fieldname,
const jsmntok_t *tok, const char *buffer);
/* Add an error code */
void json_add_errcode(struct json_stream *result, const char *fieldname,
errcode_t code);
#endif /* LIGHTNING_COMMON_JSON_H */

Loading…
Cancel
Save