listpeers: add features array using BOLT9 names.

It's actually not possible to currently tell if you're using anchor_outputs
with a peer (since it depends on whether you both supported it at *channel open*).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-added: JSON-RPC: `listpeers` shows `features` list for each channel.
This commit is contained in:
Rusty Russell
2020-08-21 11:27:20 +09:30
committed by neil saitug
parent 932709cad9
commit dd8cd81e91
5 changed files with 54 additions and 0 deletions

View File

@@ -154,6 +154,18 @@ void json_add_uncommitted_channel(struct json_stream *response,
json_add_amount_msat_compat(response, total,
"msatoshi_total", "total_msat");
}
json_array_start(response, "features");
if (feature_negotiated(uc->peer->ld->our_features,
uc->peer->their_features,
OPT_STATIC_REMOTEKEY))
json_add_string(response, NULL, "option_static_remotekey");
if (feature_negotiated(uc->peer->ld->our_features,
uc->peer->their_features,
OPT_ANCHOR_OUTPUTS))
json_add_string(response, NULL, "option_anchor_outputs");
json_array_end(response);
json_object_end(response);
}