From 8738940a8fd29a92994c248ed00a26f98ad99c8e Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 15 Jan 2019 14:33:27 +1030 Subject: [PATCH] listpeers: show channel direction for each outgoing channel. Signed-off-by: Rusty Russell --- CHANGELOG.md | 1 + lightningd/peer_control.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1f600084004..4062798b19ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - plugins: fully enabled, and ready for you to write some! - lightning-cli: `help ` finds man pages even if `make install` not run. - JSON API: `waitsendpay` now has an `erring_channel_direction` field. +- JSON API: `listpeers` now has a `channel_direction` field in `channels`. ### Changed diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index b11fe80b9659..c8c2a42db2a4 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -703,10 +703,13 @@ static void json_add_peer(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); + json_add_num(response, "channel_direction", + pubkey_idx(&ld->id, &p->id)); + } derive_channel_id(&cid, &channel->funding_txid, channel->funding_outnum);