diff --git a/doc/PLUGINS.md b/doc/PLUGINS.md index 452f54bef..ba396111a 100644 --- a/doc/PLUGINS.md +++ b/doc/PLUGINS.md @@ -888,7 +888,7 @@ throughout the node's life as new blocks appear. ```json { - "block": { + "block_added": { "hash": "000000000000000000034bdb3c01652a0aa8f63d32f949313d55af2509f9d245", "height": 753304 } diff --git a/doc/guides/Developer-s Guide/plugin-development/event-notifications.md b/doc/guides/Developer-s Guide/plugin-development/event-notifications.md index 31dd79928..aa00bcd53 100644 --- a/doc/guides/Developer-s Guide/plugin-development/event-notifications.md +++ b/doc/guides/Developer-s Guide/plugin-development/event-notifications.md @@ -423,7 +423,7 @@ Emitted after each block is received from bitcoind, either during the initial sy ```json { - "block": { + "block_added": { "hash": "000000000000000000034bdb3c01652a0aa8f63d32f949313d55af2509f9d245", "height": 753304 } diff --git a/lightningd/notification.c b/lightningd/notification.c index 3a72eb163..e05caf70b 100644 --- a/lightningd/notification.c +++ b/lightningd/notification.c @@ -598,13 +598,23 @@ void notify_balance_snapshot(struct lightningd *ld, plugins_notify(ld->plugins, take(n)); } -static void block_added_notification_serialize(struct json_stream *stream, - struct block *block) +static void json_add_block_added_fields(struct json_stream *stream, + const struct block *block) { - json_object_start(stream, "block"); json_add_string(stream, "hash", type_to_string(tmpctx, struct bitcoin_blkid, &block->blkid)); json_add_u32(stream, "height", block->height); +} + +static void block_added_notification_serialize(struct json_stream *stream, + struct block *block) +{ + /* FIXME: deprecate! */ + json_object_start(stream, "block"); + json_add_block_added_fields(stream, block); + json_object_end(stream); + json_object_start(stream, "block_added"); + json_add_block_added_fields(stream, block); json_object_end(stream); }