Skip to content

Commit 89f016f

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

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
@@ -842,9 +842,10 @@ static void gossipd_getpeers_complete(struct subd *gossip, const u8 *msg,
842842
list_for_each(&gpa->cmd->ld->peers, p, list) {
843843
json_object_start(response, NULL);
844844
json_add_string(response, "state", peer_state_name(p->state));
845-
json_add_string(response, "netaddr",
846-
type_to_string(response, struct wireaddr,
847-
&p->addr));
845+
if (p->addr.type != ADDR_TYPE_PADDING)
846+
json_add_string(response, "netaddr",
847+
type_to_string(response, struct wireaddr,
848+
&p->addr));
848849
json_add_pubkey(response, "peerid", &p->id);
849850
json_add_bool(response, "connected", p->owner != NULL);
850851
if (p->owner)

0 commit comments

Comments
 (0)