From 66d98c327fa0614fef53b91cd35433ba591f2476 Mon Sep 17 00:00:00 2001 From: adi2011 Date: Thu, 2 Feb 2023 20:31:24 +1030 Subject: [PATCH] peer_wire_is_internal helper. We are now going to have messages which we know about, but yet we don't handle ourselves. [ I reversed this from Adi's, as that was clearer! --RR ] --- wire/peer_wire.c | 14 ++++++++++++++ wire/peer_wire.h | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/wire/peer_wire.c b/wire/peer_wire.c index aa6f55493..1d3772c8f 100644 --- a/wire/peer_wire.c +++ b/wire/peer_wire.c @@ -120,6 +120,20 @@ bool is_unknown_msg_discardable(const u8 *cursor) return unknown_type(t) && (t & 1); } +/* Returns true if the message type should be handled by CLN's core */ +bool peer_wire_is_internal(enum peer_wire type) +{ + /* Unknown messages are not handled by CLN */ + if (!peer_wire_is_defined(type)) + return false; + + /* handled by pluigns */ + if (type == WIRE_PEER_STORAGE || type == WIRE_YOUR_PEER_STORAGE) + return false; + + return true; +} + /* Extract channel_id from various packets, return true if possible. */ bool extract_channel_id(const u8 *in_pkt, struct channel_id *channel_id) { diff --git a/wire/peer_wire.h b/wire/peer_wire.h index 12c951b8f..f92a9bce9 100644 --- a/wire/peer_wire.h +++ b/wire/peer_wire.h @@ -23,7 +23,8 @@ bool is_unknown_msg_discardable(const u8 *cursor); /* Return true if it's a message for gossipd. */ bool is_msg_for_gossipd(const u8 *cursor); - +/* Returns true if the message type should be treated as a custommsg */ +bool peer_wire_is_internal(enum peer_wire type); /* Extract channel_id from various packets, return true if possible. */ bool extract_channel_id(const u8 *in_pkt, struct channel_id *channel_id);