Skip to content

Commit

Permalink
peer_wire_is_internal helper.
Browse files Browse the repository at this point in the history
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 ]
  • Loading branch information
adi2011 authored and endothermicdev committed Feb 8, 2023
1 parent 5ef4914 commit 66d98c3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions wire/peer_wire.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
3 changes: 2 additions & 1 deletion wire/peer_wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 66d98c3

Please sign in to comment.