lightningd: allow filtering on custommsg hook too.

Changelog-Added: Plugins: "filters" can be specified on the `custommsg` hook to limit what message types the hook will be called for.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2025-11-20 12:07:14 +10:30
parent 81f0d0540b
commit 213cbba5bf
4 changed files with 14 additions and 8 deletions

View File

@@ -375,11 +375,11 @@ static void custommsg_payload_serialize(struct custommsg_payload *payload,
json_add_node_id(stream, "peer_id", &payload->peer_id);
}
REGISTER_PLUGIN_HOOK(custommsg,
custommsg_cb,
custommsg_final,
custommsg_payload_serialize,
struct custommsg_payload *);
REGISTER_PLUGIN_HOOK_INTFILTER(custommsg,
custommsg_cb,
custommsg_final,
custommsg_payload_serialize,
struct custommsg_payload *);
static void handle_custommsg_in(struct lightningd *ld, const u8 *msg)
{
@@ -393,7 +393,7 @@ static void handle_custommsg_in(struct lightningd *ld, const u8 *msg)
}
notify_custommsg(ld, &p->peer_id, p->msg);
plugin_hook_call_custommsg(ld, NULL, p);
plugin_hook_call_custommsg(ld, fromwire_peektype(p->msg), NULL, p);
}
static void handle_onionmsg_forward_fail(struct lightningd *ld, const u8 *msg)