mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-18 22:54:25 +01:00
plugins: fix shutdown notification to contain object.
We fixed the others. There are no fields, but this keeps it consistent. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Added: JSON-RPC: `shutdown` notification contains `shutdown` object (notification consistency)
This commit is contained in:
@@ -929,6 +929,12 @@ logging or notifications. New rpc calls will fail with error code -5 and (plugin
|
|||||||
responses will be ignored. Because lightningd can crash or be killed, a plugin cannot
|
responses will be ignored. Because lightningd can crash or be killed, a plugin cannot
|
||||||
rely on the shutdown notification always been send.
|
rely on the shutdown notification always been send.
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"shutdown": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Hooks
|
## Hooks
|
||||||
|
|
||||||
|
|||||||
@@ -700,6 +700,9 @@ bool notify_plugin_shutdown(struct lightningd *ld, struct plugin *p)
|
|||||||
struct jsonrpc_notification *n =
|
struct jsonrpc_notification *n =
|
||||||
jsonrpc_notification_start(NULL, "shutdown");
|
jsonrpc_notification_start(NULL, "shutdown");
|
||||||
|
|
||||||
|
/* Even shutdown should follow the same "object inside notification" pattern */
|
||||||
|
json_object_start(n->stream, "shutdown");
|
||||||
|
json_object_end(n->stream);
|
||||||
jsonrpc_notification_end(n);
|
jsonrpc_notification_end(n);
|
||||||
return plugin_single_notify(p, take(n));
|
return plugin_single_notify(p, take(n));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4266,7 +4266,7 @@ def test_all_subscription(node_factory, directory):
|
|||||||
"balance_snapshot: {'balance_snapshot': {'node_id': ",
|
"balance_snapshot: {'balance_snapshot': {'node_id': ",
|
||||||
"connect: {'connect': {'id': ",
|
"connect: {'connect': {'id': ",
|
||||||
"channel_state_changed: {'channel_state_changed': {'peer_id': ",
|
"channel_state_changed: {'channel_state_changed': {'peer_id': ",
|
||||||
"shutdown: {}"):
|
"shutdown: {'shutdown': {}"):
|
||||||
assert l1.daemon.is_in_log(f".*plugin-all_notifications.py: notification {notstr}.*")
|
assert l1.daemon.is_in_log(f".*plugin-all_notifications.py: notification {notstr}.*")
|
||||||
|
|
||||||
for notstr in ('block_added: ',
|
for notstr in ('block_added: ',
|
||||||
|
|||||||
Reference in New Issue
Block a user