From 8aa7a4813802cccc67d3ba6a7fb718cd2751503a Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 23 Feb 2018 16:23:47 +1030 Subject: [PATCH] listpeers: display billboard as 'status' array. Signed-off-by: Rusty Russell --- lightningd/opening_control.c | 5 +++++ lightningd/peer_control.c | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/lightningd/opening_control.c b/lightningd/opening_control.c index d145fed07..a750d901b 100644 --- a/lightningd/opening_control.c +++ b/lightningd/opening_control.c @@ -130,6 +130,11 @@ void json_add_uncommitted_channel(struct json_result *response, json_add_string(response, "owner", "lightning_openingd"); json_add_string(response, "funder", uc->fc ? "LOCAL" : "REMOTE"); + if (uc->transient_billboard) { + json_array_start(response, "status"); + json_add_string(response, NULL, uc->transient_billboard); + json_array_end(response); + } if (uc->fc) { u64 msatoshi_total, our_msatoshi; diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 580b2f5a5..be468e96d 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -660,6 +661,19 @@ static void gossipd_getpeers_complete(struct subd *gossip, const u8 *msg, json_add_num(response, "max_accepted_htlcs", channel->our_config.max_accepted_htlcs); + json_array_start(response, "status"); + for (size_t i = 0; + i < ARRAY_SIZE(channel->billboard.permanent); + i++) { + if (!channel->billboard.permanent[i]) + continue; + json_add_string(response, NULL, + channel->billboard.permanent[i]); + } + if (channel->billboard.transient) + json_add_string(response, NULL, + channel->billboard.transient); + json_array_end(response); json_object_end(response); } json_array_end(response);