From e289695012d75ba0e950d94660a59c4e04de5a1d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 10 Jul 2023 15:17:52 +0930 Subject: [PATCH] lightningd: fix rebase clash. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `deprecated_apis` is now inside `ld`. ``` lightningd/notification.c: In function ‘connect_notification_serialize’: lightningd/notification.c:60:13: error: ‘deprecated_apis’ undeclared (first use in this function) 60 | if (deprecated_apis) | ^~~~~~~~~~~~~~~ lightningd/notification.c:60:13: note: each undeclared identifier is reported only once for each function it appears in lightningd/notification.c: In function ‘disconnect_notification_serialize’: lightningd/notification.c:97:13: error: ‘deprecated_apis’ undeclared (first use in this function) 97 | if (deprecated_apis) | ^~~~~~~~~~~~~~~ lightningd/notification.c: In function ‘block_added_notification_serialize’: lightningd/notification.c:612:13: error: ‘deprecated_apis’ undeclared (first use in this function) 612 | if (deprecated_apis) { | ^~~~~~~~~~~~~~~ make: *** [Makefile:299: lightningd/notification.o] Error 1 ``` Signed-off-by: Rusty Russell --- lightningd/notification.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lightningd/notification.c b/lightningd/notification.c index a411a131b..5f584c31b 100644 --- a/lightningd/notification.c +++ b/lightningd/notification.c @@ -52,12 +52,13 @@ static void json_add_connect_fields(struct json_stream *stream, } static void connect_notification_serialize(struct json_stream *stream, + struct lightningd *ld, const struct node_id *nodeid, bool incoming, const struct wireaddr_internal *addr) { /* Old style: Add raw fields without connect key */ - if (deprecated_apis) + if (ld->deprecated_apis) json_add_connect_fields(stream, nodeid, incoming, addr); json_object_start(stream, "connect"); json_add_connect_fields(stream, nodeid, incoming, addr); @@ -73,13 +74,14 @@ void notify_connect(struct lightningd *ld, const struct wireaddr_internal *addr) { void (*serialize)(struct json_stream *, + struct lightningd *, const struct node_id *, bool, const struct wireaddr_internal *) = connect_notification_gen.serialize; struct jsonrpc_notification *n = jsonrpc_notification_start(NULL, connect_notification_gen.topic); - serialize(n->stream, nodeid, incoming, addr); + serialize(n->stream, ld, nodeid, incoming, addr); jsonrpc_notification_end(n); plugins_notify(ld->plugins, take(n)); } @@ -91,10 +93,11 @@ static void json_add_disconnect_fields(struct json_stream *stream, } static void disconnect_notification_serialize(struct json_stream *stream, + struct lightningd *ld, struct node_id *nodeid) { /* Old style: Add raw fields without disconnect key */ - if (deprecated_apis) + if (ld->deprecated_apis) json_add_disconnect_fields(stream, nodeid); json_object_start(stream, "disconnect"); json_add_disconnect_fields(stream, nodeid); @@ -107,11 +110,12 @@ REGISTER_NOTIFICATION(disconnect, void notify_disconnect(struct lightningd *ld, struct node_id *nodeid) { void (*serialize)(struct json_stream *, + struct lightningd *, struct node_id *) = disconnect_notification_gen.serialize; struct jsonrpc_notification *n = jsonrpc_notification_start(NULL, disconnect_notification_gen.topic); - serialize(n->stream, nodeid); + serialize(n->stream, ld, nodeid); jsonrpc_notification_end(n); plugins_notify(ld->plugins, take(n)); } @@ -607,9 +611,10 @@ static void json_add_block_added_fields(struct json_stream *stream, } static void block_added_notification_serialize(struct json_stream *stream, + struct lightningd *ld, struct block *block) { - if (deprecated_apis) { + if (ld->deprecated_apis) { json_object_start(stream, "block"); json_add_block_added_fields(stream, block); json_object_end(stream); @@ -626,11 +631,12 @@ void notify_block_added(struct lightningd *ld, const struct block *block) { void (*serialize)(struct json_stream *, + struct lightningd *ld, const struct block *block) = block_added_notification_gen.serialize; struct jsonrpc_notification *n = jsonrpc_notification_start(NULL, "block_added"); - serialize(n->stream, block); + serialize(n->stream, ld, block); jsonrpc_notification_end(n); plugins_notify(ld->plugins, take(n)); }