mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
plugin: Register connect
notification
This commit is contained in:
parent
25d79c5c3f
commit
c289fa8f19
@ -5,7 +5,6 @@
|
|||||||
#include <lightningd/peer_htlcs.h>
|
#include <lightningd/peer_htlcs.h>
|
||||||
|
|
||||||
const char *notification_topics[] = {
|
const char *notification_topics[] = {
|
||||||
"connect",
|
|
||||||
"disconnect",
|
"disconnect",
|
||||||
"warning",
|
"warning",
|
||||||
"invoice_payment",
|
"invoice_payment",
|
||||||
@ -39,13 +38,27 @@ bool notifications_have_topic(const char *topic)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void connect_notification_serialize(struct json_stream *stream,
|
||||||
|
struct node_id *nodeid,
|
||||||
|
struct wireaddr_internal *addr)
|
||||||
|
{
|
||||||
|
json_add_node_id(stream, "id", nodeid);
|
||||||
|
json_add_address_internal(stream, "address", addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
REGISTER_NOTIFICATION(connect,
|
||||||
|
connect_notification_serialize);
|
||||||
|
|
||||||
void notify_connect(struct lightningd *ld, struct node_id *nodeid,
|
void notify_connect(struct lightningd *ld, struct node_id *nodeid,
|
||||||
struct wireaddr_internal *addr)
|
struct wireaddr_internal *addr)
|
||||||
{
|
{
|
||||||
struct jsonrpc_notification *n =
|
void (*serialize)(struct json_stream *,
|
||||||
jsonrpc_notification_start(NULL, "connect");
|
struct node_id *,
|
||||||
json_add_node_id(n->stream, "id", nodeid);
|
struct wireaddr_internal *) = connect_notification_gen.serialize;
|
||||||
json_add_address_internal(n->stream, "address", addr);
|
|
||||||
|
struct jsonrpc_notification *n
|
||||||
|
= jsonrpc_notification_start(NULL, connect_notification_gen.topic);
|
||||||
|
serialize(n->stream, nodeid, addr);
|
||||||
jsonrpc_notification_end(n);
|
jsonrpc_notification_end(n);
|
||||||
plugins_notify(ld->plugins, take(n));
|
plugins_notify(ld->plugins, take(n));
|
||||||
}
|
}
|
||||||
@ -149,7 +162,3 @@ void notify_forward_event(struct lightningd *ld,
|
|||||||
jsonrpc_notification_end(n);
|
jsonrpc_notification_end(n);
|
||||||
plugins_notify(ld->plugins, take(n));
|
plugins_notify(ld->plugins, take(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: It's a dummy notification. Will be removed when we have a 'real' one
|
|
||||||
* in this file. */
|
|
||||||
REGISTER_JSON_INTERNAL_COMMAND(hello_notification, NULL, void *);
|
|
||||||
|
Loading…
Reference in New Issue
Block a user