hooks: Serialize the peer that connected as hook call payload

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 <decker.christian@gmail.com>
This commit is contained in:
Christian Decker 2019-02-07 15:46:15 +01:00
parent 828d088d60
commit b5085a9c17

View File

@ -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 *