mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 23:54:22 +01:00
jsonrpc: Include the direction also if we have an alias
The direction only depends on the ordering between node_ids, not the short_channel_id, so we can include it and it won't change. This was causing some trouble loading the `channel_hints` in the `pay` plugin.
This commit is contained in:
@@ -653,12 +653,17 @@ static void json_add_channel(struct lightningd *ld,
|
||||
if (channel->owner)
|
||||
json_add_string(response, "owner", channel->owner->name);
|
||||
|
||||
if (channel->scid) {
|
||||
if (channel->scid)
|
||||
json_add_short_channel_id(response, "short_channel_id",
|
||||
channel->scid);
|
||||
|
||||
/* If there is any way we can use the channel we'd better have
|
||||
* a direction attached. Technically we could always add it,
|
||||
* as it's just the lexicographic order between node_ids, but
|
||||
* why bother if we can't use it? */
|
||||
if (channel->scid || channel->alias[LOCAL] || channel->alias[REMOTE])
|
||||
json_add_num(response, "direction",
|
||||
node_id_idx(&ld->id, &channel->peer->id));
|
||||
}
|
||||
|
||||
json_add_string(response, "channel_id",
|
||||
type_to_string(tmpctx, struct channel_id, &channel->cid));
|
||||
|
||||
Reference in New Issue
Block a user