mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
notification: disconnect with json key disconnect
Changelog-Added: JSON-RPC: `connect` and `disconnect` notifications now wrap `id` field in a `connect`/`disconnect` object (consistency with other notifications)
This commit is contained in:
committed by
Rusty Russell
parent
e247d16536
commit
79092c16b1
@@ -528,7 +528,9 @@ to a peer was lost.
|
||||
|
||||
```json
|
||||
{
|
||||
"disconnect": {
|
||||
"id": "02f6725f9c1c40333b67faea92fd211c183050f28df32cac3f9d69685fe9665432"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -103,7 +103,9 @@ A notification for topic `disconnect` is sent every time a connection to a peer
|
||||
|
||||
```json
|
||||
{
|
||||
"disconnect": {
|
||||
"id": "02f6725f9c1c40333b67faea92fd211c183050f28df32cac3f9d69685fe9665432"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -84,10 +84,21 @@ void notify_connect(struct lightningd *ld,
|
||||
plugins_notify(ld->plugins, take(n));
|
||||
}
|
||||
|
||||
static void json_add_disconnect_fields(struct json_stream *stream,
|
||||
const struct node_id *nodeid)
|
||||
{
|
||||
json_add_node_id(stream, "id", nodeid);
|
||||
}
|
||||
|
||||
static void disconnect_notification_serialize(struct json_stream *stream,
|
||||
struct node_id *nodeid)
|
||||
{
|
||||
json_add_node_id(stream, "id", nodeid);
|
||||
/* Old style: Add raw fields without disconnect key */
|
||||
/* FIXME: deprecate! */
|
||||
json_add_disconnect_fields(stream, nodeid);
|
||||
json_object_start(stream, "disconnect");
|
||||
json_add_disconnect_fields(stream, nodeid);
|
||||
json_object_end(stream);
|
||||
}
|
||||
|
||||
REGISTER_NOTIFICATION(disconnect,
|
||||
|
||||
Reference in New Issue
Block a user