diff --git a/doc/lightning-listpeerchannels.7.md b/doc/lightning-listpeerchannels.7.md index d20514eaf..5c4f1c95e 100644 --- a/doc/lightning-listpeerchannels.7.md +++ b/doc/lightning-listpeerchannels.7.md @@ -342,4 +342,4 @@ Main web site: Lightning RFC site (BOLT \#9): -[comment]: # ( SHA256STAMP:adc1f36b764f1d98ba6a34b63f459a19db15fc94e37678806a1eb858a2166167) +[comment]: # ( SHA256STAMP:a9e27c78498192757d4972da091715cadd8dbf2f0c08c288e6c600626567f379) diff --git a/plugins/libplugin.c b/plugins/libplugin.c index ff01660f2..c63da78a5 100644 --- a/plugins/libplugin.c +++ b/plugins/libplugin.c @@ -1915,8 +1915,8 @@ static struct listpeers_channel *json_to_listpeers_channel(const tal_t *ctx, *aliastok = json_get_member(buffer, tok, "alias"), *max_htlcs = json_get_member(buffer, tok, "max_accepted_htlcs"), *htlcstok = json_get_member(buffer, tok, "htlcs"), - *idtok = json_get_member(buffer, tok, "id"), - *conntok = json_get_member(buffer, tok, "connected"); + *idtok = json_get_member(buffer, tok, "peer_id"), + *conntok = json_get_member(buffer, tok, "peer_connected"); chan = tal(ctx, struct listpeers_channel); diff --git a/plugins/topology.c b/plugins/topology.c index f6831ccff..510a7901a 100644 --- a/plugins/topology.c +++ b/plugins/topology.c @@ -301,25 +301,23 @@ static struct node_map *local_connected(const tal_t *ctx, const jsmntok_t *result) { size_t i; - const jsmntok_t *t, *peers = json_get_member(buf, result, "peers"); + const jsmntok_t *channel, *channels = json_get_member(buf, result, "channels"); struct node_map *connected = tal(ctx, struct node_map); node_map_init(connected); tal_add_destructor(connected, node_map_clear); - json_for_each_arr(i, t, peers) { - const jsmntok_t *chans, *c; + json_for_each_arr(i, channel, channels) { struct node_id id; bool is_connected, normal_chan; const char *err; - size_t j; - err = json_scan(tmpctx, buf, t, - "{id:%,connected:%}", + err = json_scan(tmpctx, buf, channel, + "{peer_id:%,peer_connected:%}", JSON_SCAN(json_to_node_id, &id), JSON_SCAN(json_to_bool, &is_connected)); if (err) - plugin_err(plugin, "Bad listpeers response (%s): %.*s", + plugin_err(plugin, "Bad listpeerchannels response (%s): %.*s", err, json_tok_full_len(result), json_tok_full(buf, result)); @@ -328,14 +326,9 @@ static struct node_map *local_connected(const tal_t *ctx, continue; /* Must also have a channel in CHANNELD_NORMAL */ - normal_chan = false; - chans = json_get_member(buf, t, "channels"); - json_for_each_arr(j, c, chans) { - if (json_tok_streq(buf, - json_get_member(buf, c, "state"), - "CHANNELD_NORMAL")) - normal_chan = true; - } + normal_chan = json_tok_streq(buf, + json_get_member(buf, channel, "state"), + "CHANNELD_NORMAL"); if (normal_chan) node_map_add(connected, @@ -346,7 +339,7 @@ static struct node_map *local_connected(const tal_t *ctx, } /* We want to combine local knowledge to we know which are actually inactive! */ -static struct command_result *listpeers_done(struct command *cmd, +static struct command_result *listpeerchannels_done(struct command *cmd, const char *buf, const jsmntok_t *result, struct listchannels_opts *opts) @@ -421,8 +414,8 @@ static struct command_result *json_listchannels(struct command *cmd, "Can only specify one of " "`short_channel_id`, " "`source` or `destination`"); - req = jsonrpc_request_start(cmd->plugin, cmd, "listpeers", - listpeers_done, forward_error, opts); + req = jsonrpc_request_start(cmd->plugin, cmd, "listpeerchannels", + listpeerchannels_done, forward_error, opts); return send_outreq(cmd->plugin, req); }