Skip to content

Commit 173dbf2

Browse files
committed
jsonrpc: Only print netaddr in getpeers when we know it
Fixes #285 Signed-off-by: Christian Decker <[email protected]>
1 parent 5320cab commit 173dbf2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lightningd/peer_control.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -816,9 +816,10 @@ static void gossipd_getpeers_complete(struct subd *gossip, const u8 *msg,
816816
list_for_each(&gpa->cmd->ld->peers, p, list) {
817817
json_object_start(response, NULL);
818818
json_add_string(response, "state", peer_state_name(p->state));
819-
json_add_string(response, "netaddr",
820-
type_to_string(response, struct wireaddr,
821-
&p->addr));
819+
if (p->addr.type > 0)
820+
json_add_string(response, "netaddr",
821+
type_to_string(response, struct wireaddr,
822+
&p->addr));
822823
json_add_pubkey(response, "peerid", &p->id);
823824
json_add_bool(response, "connected", p->owner != NULL);
824825
if (p->owner)

0 commit comments

Comments
 (0)