From 9fd84169bb688255d117464b1ada32e41e7071e4 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Wed, 4 Dec 2019 23:02:54 +0100 Subject: [PATCH] common: Add an assertion for custommsgs in gossip handler This is mainly meant as a marker so that we can later remove the code if we decide to make the handling of custommsgs a non-developer option. It marks the place that we would otherwise handle what in dev-mode is a custommsg. --- common/read_peer_msg.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/read_peer_msg.c b/common/read_peer_msg.c index f6c74e1df..da52b903e 100644 --- a/common/read_peer_msg.c +++ b/common/read_peer_msg.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -155,6 +156,11 @@ bool handle_peer_gossip_or_error(struct per_peer_state *pps, bool all_channels; struct channel_id actual; +#if DEVELOPER + /* Any odd-typed unknown message is handled by the caller, so if we + * find one here it's an error. */ + assert(!is_unknown_msg_discardable(msg)); +#else /* BOLT #1: * * A receiving node: @@ -163,6 +169,7 @@ bool handle_peer_gossip_or_error(struct per_peer_state *pps, */ if (is_unknown_msg_discardable(msg)) goto handled; +#endif if (handle_timestamp_filter(pps, msg)) return true;