Browse Source

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>
connected_hook
Christian Decker 6 years ago
parent
commit
408846f758
No known key found for this signature in database GPG Key ID: 1416D83DC4F0E86D
  1. 9
      lightningd/peer_control.c

9
lightningd/peer_control.c

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

Loading…
Cancel
Save