From a9e346a1f4ba1b5a6a96618f16286b0ecba84507 Mon Sep 17 00:00:00 2001 From: trueptolemy Date: Sat, 10 Aug 2019 16:19:57 +0800 Subject: [PATCH] json: Add the json interface for `struct sha256` --- lightningd/json.c | 6 ++++++ lightningd/json.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/lightningd/json.c b/lightningd/json.c index 09b876343..bbc533a2c 100644 --- a/lightningd/json.c +++ b/lightningd/json.c @@ -472,3 +472,9 @@ void json_add_secret(struct json_stream *response, const char *fieldname, { json_add_hex(response, fieldname, secret, sizeof(struct secret)); } + +void json_add_sha256(struct json_stream *result, const char *fieldname, + const struct sha256 *hash) +{ + json_add_hex(result, fieldname, hash, sizeof(*hash)); +} diff --git a/lightningd/json.h b/lightningd/json.h index 52183ccdf..1eaaf92d6 100644 --- a/lightningd/json.h +++ b/lightningd/json.h @@ -214,4 +214,7 @@ void json_add_timeabs(struct json_stream *result, const char *fieldname, void json_add_time(struct json_stream *result, const char *fieldname, struct timespec ts); +void json_add_sha256(struct json_stream *result, const char *fieldname, + const struct sha256 *hash); + #endif /* LIGHTNING_LIGHTNINGD_JSON_H */