Skip to content

Commit

Permalink
hooks: Serialize the peer that connected as hook call payload
Browse files Browse the repository at this point in the history
The format is very similar to the one for `listpeers` except we only
list a single channel, and we list the actual netaddr that connected
instead of all known from gossip.

Signed-off-by: Christian Decker <[email protected]>
  • Loading branch information
cdecker committed Feb 20, 2019
1 parent 828d088 commit b5085a9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lightningd/peer_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,15 @@ static void
peer_connected_serialize(struct peer_connected_hook_payload *payload,
struct json_stream *stream)
{
const struct peer *p = payload->peer;
json_object_start(stream, "peer");
json_add_pubkey(stream, "id", &p->id);
json_add_string(
stream, "addr",
type_to_string(stream, struct wireaddr_internal, &payload->addr));
json_add_hex_talarr(stream, "globalfeatures", p->globalfeatures);
json_add_hex_talarr(stream, "localfeatures", p->localfeatures);
json_object_end(stream); /* .peer */
}

static struct peer_connected_hook_response *
Expand Down

0 comments on commit b5085a9

Please sign in to comment.