mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
listchannels: also list splicing channels as active: true.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
0147b3ba94
commit
bcea0a9580
@ -298,13 +298,14 @@ static struct node_map *local_connected(const tal_t *ctx,
|
||||
|
||||
json_for_each_arr(i, channel, channels) {
|
||||
struct node_id id;
|
||||
bool is_connected, normal_chan;
|
||||
const char *err;
|
||||
bool is_connected;
|
||||
const char *err, *state;
|
||||
|
||||
err = json_scan(tmpctx, buf, channel,
|
||||
"{peer_id:%,peer_connected:%}",
|
||||
"{peer_id:%,peer_connected:%,state:%}",
|
||||
JSON_SCAN(json_to_node_id, &id),
|
||||
JSON_SCAN(json_to_bool, &is_connected));
|
||||
JSON_SCAN(json_to_bool, &is_connected),
|
||||
JSON_SCAN_TAL(tmpctx, json_strdup, &state));
|
||||
if (err)
|
||||
plugin_err(plugin, "Bad listpeerchannels response (%s): %.*s",
|
||||
err,
|
||||
@ -314,18 +315,13 @@ static struct node_map *local_connected(const tal_t *ctx,
|
||||
if (!is_connected)
|
||||
continue;
|
||||
|
||||
/* Must also have a channel in CHANNELD_NORMAL */
|
||||
normal_chan = json_tok_streq(buf,
|
||||
json_get_member(buf, channel, "state"),
|
||||
"CHANNELD_NORMAL")
|
||||
|| json_tok_streq(buf,
|
||||
json_get_member(buf, channel, "state"),
|
||||
"CHANNELD_AWAITING_SPLICE");
|
||||
|
||||
if (normal_chan)
|
||||
/* Must also have a channel in CHANNELD_NORMAL/splice */
|
||||
if (streq(state, "CHANNELD_NORMAL")
|
||||
|| streq(state, "CHANNELD_AWAITING_SPLICE")) {
|
||||
node_map_add(connected,
|
||||
tal_dup(connected, struct node_id, &id));
|
||||
}
|
||||
}
|
||||
|
||||
return connected;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user