common: move gossip_store_wire.csv into common/ from gossipd/
What changed, and why it matters
This commit simply moves a file that defines internal message formats from one directory to another and updates all the references. It is a code reorganization (refactoring) with no functional change to the program's behavior and no security relevance.
No security action needed. Treat as routine refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit relocates gossip_store_wire.csv from gossipd/ to common/ because common/gossip_store.c (and other common consumers) use the generated wire protocol definitions. It updates Makefiles and source files to include common/gossip_store_wiregen.h instead of gossipd/gossip_store_wiregen.h, and removes the old file. The wire protocol definitions themselves are unchanged.
Changed components
common/gossip_store.ccommon/gossmap.cconnectd/gossip_store.cgossipd/gossip_store.cgossipd/gossmap_manage.cplugins/sql.cdevtools/convert-gossmap.cdevtools/create-gossipstore.cdevtools/dump-gossipstore.cdevtools/gossmap-compress.ccommon/gossip_store_wire.csvgossipd/gossip_store_wire.csvMakefilecommon/Makefileconnectd/Makefilegossipd/Makefileplugins/Makefiledevtools/MakefileInspect captured patch +66 / −72
diff --git a/Makefile b/Makefile
index fd6c8aa7..fd20d652 100644
--- a/Makefile
+++ b/Makefile
@@ -489,9 +489,14 @@ mkdocs.yml: $(MANPAGES:=.md)
# Every single object file.
ALL_OBJS := $(ALL_C_SOURCES:.c=.o)
+WIREGEN_FILES := $(filter %printgen.h %printgen.c %wiregen.h %wiregen.c, $(ALL_C_HEADERS) $(ALL_C_SOURCES))
+
+# Always make wiregen files before any object file
+$(ALL_OBJS): $(WIREGEN_FILES)
+
# We always regen wiregen and printgen files, since SHA256STAMP protects against
# spurious rebuilds.
-$(filter %printgen.h %printgen.c %wiregen.h %wiregen.c, $(ALL_C_HEADERS) $(ALL_C_SOURCES)): $(FORCE)
+$(WIREGEN_FILES): $(FORCE)
ifneq ($(TEST_GROUP_COUNT),)
PYTEST_OPTS += --test-group=$(TEST_GROUP) --test-group-count=$(TEST_GROUP_COUNT)
diff --git a/common/Makefile b/common/Makefile
index 333e3321..41926116 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -111,7 +111,7 @@ COMMON_SRC_NOGEN := \
common/wire_error.c
-COMMON_SRC_GEN := common/status_wiregen.c common/peer_status_wiregen.c common/scb_wiregen.c
+COMMON_SRC_GEN := common/status_wiregen.c common/peer_status_wiregen.c common/scb_wiregen.c common/gossip_store_wiregen.c
COMMON_HEADERS_NOGEN := $(COMMON_SRC_NOGEN:.c=.h) \
common/closing_fee.h \
@@ -124,7 +124,7 @@ COMMON_HEADERS_NOGEN := $(COMMON_SRC_NOGEN:.c=.h) \
common/jsonrpc_errors.h \
common/overflows.h
-COMMON_HEADERS_GEN := common/htlc_state_names_gen.h common/status_wiregen.h common/peer_status_wiregen.h common/scb_wiregen.h
+COMMON_HEADERS_GEN := common/htlc_state_names_gen.h common/status_wiregen.h common/peer_status_wiregen.h common/scb_wiregen.h common/gossip_store_wiregen.h
COMMON_HEADERS := $(COMMON_HEADERS_GEN) $(COMMON_HEADERS_NOGEN)
COMMON_SRC := $(COMMON_SRC_NOGEN) $(COMMON_SRC_GEN)
@@ -157,8 +157,6 @@ ALL_C_SOURCES += $(COMMON_SRC)
common/htlc_state_names_gen.h: common/htlc_state.h ccan/ccan/cdump/tools/cdump-enumstr
ccan/ccan/cdump/tools/cdump-enumstr common/htlc_state.h > $@
-common/gossip_store.o: gossipd/gossip_store_wiregen.h
-
check-source-bolt: $(COMMON_SRC_NOGEN:%=bolt-check/%) $(COMMON_HEADERS:%=bolt-check/%)
check-whitespace: $(COMMON_SRC_NOGEN:%=check-whitespace/%) $(COMMON_HEADERS:%=check-whitespace/%)
diff --git a/common/gossip_store.c b/common/gossip_store.c
index 3f10dd82..298988a1 100644
--- a/common/gossip_store.c
+++ b/common/gossip_store.c
@@ -1,6 +1,6 @@
#include "config.h"
#include <common/gossip_store.h>
-#include <gossipd/gossip_store_wiregen.h>
+#include <common/gossip_store_wiregen.h>
#include <unistd.h>
/* We cheat and read first two bytes of message too. */
diff --git a/common/gossip_store_wire.csv b/common/gossip_store_wire.csv
new file mode 100644
index 00000000..d371f9e8
--- /dev/null
+++ b/common/gossip_store_wire.csv
@@ -0,0 +1,33 @@
+# gossip_store messages: messages persisted in the gossip_store
+# We store raw messages here, so these numbers must not overlap with
+# 256/257/258.
+#include <common/amount.h>
+#include <common/node_id.h>
+
+# This always follows the channel_announce / private_announce
+msgtype,gossip_store_channel_amount,4101
+msgdata,gossip_store_channel_amount,satoshis,amount_sat,
+
+# Mimics a channel_announce, except signatures are all-zero
+msgtype,gossip_store_private_channel_obs,4104
+msgdata,gossip_store_private_channel_obs,satoshis,amount_sat,
+msgdata,gossip_store_private_channel_obs,len,u16,
+msgdata,gossip_store_private_channel_obs,announcement,u8,len
+
+msgtype,gossip_store_private_update_obs,4102
+msgdata,gossip_store_private_update_obs,len,u16,
+msgdata,gossip_store_private_update_obs,update,u8,len
+
+msgtype,gossip_store_delete_chan,4103
+msgdata,gossip_store_delete_chan,scid,short_channel_id,
+
+msgtype,gossip_store_ended,4105
+msgdata,gossip_store_ended,equivalent_offset,u64,
+msgdata,gossip_store_ended,uuid,u8,32
+
+msgtype,gossip_store_chan_dying,4106
+msgdata,gossip_store_chan_dying,scid,short_channel_id,
+msgdata,gossip_store_chan_dying,blockheight,u32,
+
+msgtype,gossip_store_uuid,4107
+msgdata,gossip_store_uuid,uuid,u8,32
diff --git a/common/gossmap.c b/common/gossmap.c
index 69a3dbef..d0bb948f 100644
--- a/common/gossmap.c
+++ b/common/gossmap.c
@@ -6,12 +6,12 @@
#include <ccan/tal/str/str.h>
#include <common/features.h>
#include <common/gossip_store.h>
+#include <common/gossip_store_wiregen.h>
#include <common/gossmap.h>
#include <common/sciddir_or_pubkey.h>
#include <common/utils.h>
#include <errno.h>
#include <fcntl.h>
-#include <gossipd/gossip_store_wiregen.h>
#include <inttypes.h>
#include <stdio.h>
#include <sys/mman.h>
diff --git a/common/test/Makefile b/common/test/Makefile
index ab192ce6..988ef151 100644
--- a/common/test/Makefile
+++ b/common/test/Makefile
@@ -47,7 +47,7 @@ common/test/run-route common/test/run-route-specific common/test/run-route-inflo
common/node_id.o \
common/pseudorand.o \
common/route.o \
- gossipd/gossip_store_wiregen.o \
+ common/gossip_store_wiregen.o \
wire/fromwire.o \
wire/peer_wiregen.o \
wire/towire.o
diff --git a/common/test/run-route-specific.c b/common/test/run-route-specific.c
index 6e73f459..74653e20 100644
--- a/common/test/run-route-specific.c
+++ b/common/test/run-route-specific.c
@@ -7,22 +7,22 @@
*/
#include "config.h"
#include <assert.h>
+#include <bitcoin/chainparams.h>
#include <ccan/crc32c/crc32c.h>
#include <common/channel_type.h>
#include <common/dijkstra.h>
-#include <common/gossmap.h>
#include <common/gossip_store.h>
+#include <common/gossip_store_wiregen.h>
+#include <common/gossmap.h>
#include <common/memleak.h>
#include <common/randbytes.h>
#include <common/route.h>
#include <common/sciddir_or_pubkey.h>
#include <common/setup.h>
#include <common/utils.h>
-#include <bitcoin/chainparams.h>
-#include <gossipd/gossip_store_wiregen.h>
#include <stdio.h>
-#include <wire/peer_wiregen.h>
#include <unistd.h>
+#include <wire/peer_wiregen.h>
/* AUTOGENERATED MOCKS START */
/* Generated stub for fromwire_bigsize */
diff --git a/common/test/run-route.c b/common/test/run-route.c
index 53c73591..50f3f3b9 100644
--- a/common/test/run-route.c
+++ b/common/test/run-route.c
@@ -1,21 +1,21 @@
#include "config.h"
#include <assert.h>
+#include <bitcoin/chainparams.h>
#include <ccan/crc32c/crc32c.h>
#include <common/channel_type.h>
#include <common/dijkstra.h>
-#include <common/gossmap.h>
#include <common/gossip_store.h>
+#include <common/gossip_store_wiregen.h>
+#include <common/gossmap.h>
#include <common/memleak.h>
#include <common/randbytes.h>
#include <common/route.h>
#include <common/sciddir_or_pubkey.h>
#include <common/setup.h>
#include <common/utils.h>
-#include <bitcoin/chainparams.h>
-#include <gossipd/gossip_store_wiregen.h>
#include <stdio.h>
-#include <wire/peer_wiregen.h>
#include <unistd.h>
+#include <wire/peer_wiregen.h>
/* AUTOGENERATED MOCKS START */
/* Generated stub for fromwire_bigsize */
diff --git a/connectd/Makefile b/connectd/Makefile
index 33e6e8b6..4cec6fdd 100644
--- a/connectd/Makefile
+++ b/connectd/Makefile
@@ -35,7 +35,7 @@ ALL_PROGRAMS += lightningd/lightning_websocketd
LIGHTNINGD_CONTROL_HEADERS += connectd/connectd_wiregen.h
LIGHTNINGD_CONTROL_OBJS += connectd/connectd_wiregen.o
-lightningd/lightning_connectd: $(CONNECTD_OBJS) $(HSMD_CLIENT_OBJS) gossipd/gossipd_wiregen.o gossipd/gossip_store_wiregen.o libcommon.a
+lightningd/lightning_connectd: $(CONNECTD_OBJS) $(HSMD_CLIENT_OBJS) gossipd/gossipd_wiregen.o libcommon.a
lightningd/lightning_websocketd: $(WEBSOCKETD_OBJS) libcommon.a
diff --git a/connectd/gossip_store.c b/connectd/gossip_store.c
index 92298458..3c1808f6 100644
--- a/connectd/gossip_store.c
+++ b/connectd/gossip_store.c
@@ -1,11 +1,11 @@
#include "config.h"
#include <ccan/crc32c/crc32c.h>
+#include <common/gossip_store_wiregen.h>
#include <common/status.h>
#include <common/utils.h>
#include <connectd/gossip_store.h>
#include <errno.h>
#include <fcntl.h>
-#include <gossipd/gossip_store_wiregen.h>
#include <inttypes.h>
#include <unistd.h>
#include <wire/peer_wire.h>
diff --git a/contrib/pyln-client/pyln/client/gossmap.py b/contrib/pyln-client/pyln/client/gossmap.py
index b797f202..920974a4 100755
--- a/contrib/pyln-client/pyln/client/gossmap.py
+++ b/contrib/pyln-client/pyln/client/gossmap.py
@@ -18,7 +18,7 @@ GOSSIP_STORE_LEN_DELETED_BIT = 0x8000
GOSSIP_STORE_LEN_PUSH_BIT = 0x4000
GOSSIP_STORE_LEN_COMPLETE_BIT = 0x2000
-# These duplicate constants in lightning/gossipd/gossip_store_wiregen.h
+# These duplicate constants in lightning/common/gossip_store_wiregen.h
WIRE_GOSSIP_STORE_PRIVATE_CHANNEL = 4104
WIRE_GOSSIP_STORE_PRIVATE_UPDATE = 4102
WIRE_GOSSIP_STORE_DELETE_CHAN = 4103
diff --git a/devtools/Makefile b/devtools/Makefile
index b7c48740..3d84e927 100644
--- a/devtools/Makefile
+++ b/devtools/Makefile
@@ -20,11 +20,6 @@ $(DEVTOOLS): %: %.o libcommon.a
$(DEVTOOLS_TOOL_OBJS): wire/wire.h
# Some devtools require extra objects
-DEVTOOLS_NEEDS_GOSSIP_STORE := devtools/gossmap-compress devtools/dump-gossipstore devtools/convert-gossmap devtools/create-gossipstore
-
-$(DEVTOOLS_NEEDS_GOSSIP_STORE): gossipd/gossip_store_wiregen.o
-$(DEVTOOLS_NEEDS_GOSSIP_STORE:=.o): gossipd/gossip_store_wiregen.h
-
devtools/decodemsg: devtools/print_wire.o
devtools/decodemsg.o: devtools/print_wire.h
diff --git a/devtools/convert-gossmap.c b/devtools/convert-gossmap.c
index c5ee23c9..efc30855 100644
--- a/devtools/convert-gossmap.c
+++ b/devtools/convert-gossmap.c
@@ -3,8 +3,8 @@
#include <ccan/err/err.h>
#include <ccan/read_write_all/read_write_all.h>
#include <common/gossip_store.h>
+#include <common/gossip_store_wiregen.h>
#include <common/utils.h>
-#include <gossipd/gossip_store_wiregen.h>
#include <unistd.h>
#include <wire/peer_wire.h>
diff --git a/devtools/create-gossipstore.c b/devtools/create-gossipstore.c
index 320ad9f3..226324e3 100644
--- a/devtools/create-gossipstore.c
+++ b/devtools/create-gossipstore.c
@@ -4,9 +4,9 @@
#include <ccan/opt/opt.h>
#include <ccan/read_write_all/read_write_all.h>
#include <common/gossip_store.h>
+#include <common/gossip_store_wiregen.h>
#include <common/utils.h>
#include <fcntl.h>
-#include <gossipd/gossip_store_wiregen.h>
#include <inttypes.h>
#include <stdio.h>
#include <unistd.h>
diff --git a/devtools/dump-gossipstore.c b/devtools/dump-gossipstore.c
index c748d76c..252edf94 100644
--- a/devtools/dump-gossipstore.c
+++ b/devtools/dump-gossipstore.c
@@ -3,10 +3,10 @@
#include <ccan/err/err.h>
#include <ccan/opt/opt.h>
#include <common/gossip_store.h>
+#include <common/gossip_store_wiregen.h>
#include <common/setup.h>
#include <common/utils.h>
#include <fcntl.h>
-#include <gossipd/gossip_store_wiregen.h>
#include <inttypes.h>
#include <stdio.h>
#include <unistd.h>
diff --git a/devtools/gossmap-compress.c b/devtools/gossmap-compress.c
index be91e7f0..146dad47 100644
--- a/devtools/gossmap-compress.c
+++ b/devtools/gossmap-compress.c
@@ -7,12 +7,12 @@
#include <ccan/read_write_all/read_write_all.h>
#include <ccan/tal/str/str.h>
#include <common/gossip_store.h>
+#include <common/gossip_store_wiregen.h>
#include <common/gossmap.h>
#include <common/setup.h>
#include <common/utils.h>
#include <errno.h>
#include <fcntl.h>
-#include <gossipd/gossip_store_wiregen.h>
#include <stdio.h>
#include <unistd.h>
#include <wire/peer_wiregen.h>
diff --git a/gossipd/Makefile b/gossipd/Makefile
index 1ee7a275..e92cd1f2 100644
--- a/gossipd/Makefile
+++ b/gossipd/Makefile
@@ -1,7 +1,6 @@
#! /usr/bin/make
GOSSIPD_HEADERS_WSRC := gossipd/gossipd_wiregen.h \
- gossipd/gossip_store_wiregen.h \
gossipd/gossipd.h \
gossipd/gossip_store.h \
gossipd/gossmap_manage.h \
diff --git a/gossipd/gossip_store.c b/gossipd/gossip_store.c
index 91c6c28f..2c358bec 100644
--- a/gossipd/gossip_store.c
+++ b/gossipd/gossip_store.c
@@ -5,12 +5,12 @@
#include <ccan/tal/str/str.h>
#include <common/clock_time.h>
#include <common/gossip_store.h>
+#include <common/gossip_store_wiregen.h>
#include <common/status.h>
#include <common/utils.h>
#include <errno.h>
#include <fcntl.h>
#include <gossipd/gossip_store.h>
-#include <gossipd/gossip_store_wiregen.h>
#include <gossipd/gossipd.h>
#include <inttypes.h>
#include <sys/stat.h>
diff --git a/gossipd/gossip_store_wire.csv b/gossipd/gossip_store_wire.csv
deleted file mode 100644
index d371f9e8..00000000
--- a/gossipd/gossip_store_wire.csv
+++ /dev/null
@@ -1,33 +0,0 @@
-# gossip_store messages: messages persisted in the gossip_store
-# We store raw messages here, so these numbers must not overlap with
-# 256/257/258.
-#include <common/amount.h>
-#include <common/node_id.h>
-
-# This always follows the channel_announce / private_announce
-msgtype,gossip_store_channel_amount,4101
-msgdata,gossip_store_channel_amount,satoshis,amount_sat,
-
-# Mimics a channel_announce, except signatures are all-zero
-msgtype,gossip_store_private_channel_obs,4104
-msgdata,gossip_store_private_channel_obs,satoshis,amount_sat,
-msgdata,gossip_store_private_channel_obs,len,u16,
-msgdata,gossip_store_private_channel_obs,announcement,u8,len
-
-msgtype,gossip_store_private_update_obs,4102
-msgdata,gossip_store_private_update_obs,len,u16,
-msgdata,gossip_store_private_update_obs,update,u8,len
-
-msgtype,gossip_store_delete_chan,4103
-msgdata,gossip_store_delete_chan,scid,short_channel_id,
-
-msgtype,gossip_store_ended,4105
-msgdata,gossip_store_ended,equivalent_offset,u64,
-msgdata,gossip_store_ended,uuid,u8,32
-
-msgtype,gossip_store_chan_dying,4106
-msgdata,gossip_store_chan_dying,scid,short_channel_id,
-msgdata,gossip_store_chan_dying,blockheight,u32,
-
-msgtype,gossip_store_uuid,4107
-msgdata,gossip_store_uuid,uuid,u8,32
diff --git a/gossipd/gossmap_manage.c b/gossipd/gossmap_manage.c
index 556104c7..4ae675d8 100644
--- a/gossipd/gossmap_manage.c
+++ b/gossipd/gossmap_manage.c
@@ -5,6 +5,7 @@
#include <common/clock_time.h>
#include <common/daemon_conn.h>
#include <common/gossip_store.h>
+#include <common/gossip_store_wiregen.h>
#include <common/gossmap.h>
#include <common/memleak.h>
#include <common/status.h>
@@ -12,7 +13,6 @@
#include <common/utils.h>
#include <common/wire_error.h>
#include <gossipd/gossip_store.h>
-#include <gossipd/gossip_store_wiregen.h>
#include <gossipd/gossipd.h>
#include <gossipd/gossipd_wiregen.h>
#include <gossipd/gossmap_manage.h>
diff --git a/plugins/Makefile b/plugins/Makefile
index 7ca2622e..8a01fa33 100644
--- a/plugins/Makefile
+++ b/plugins/Makefile
@@ -231,7 +231,7 @@ plugins/sql-schema_gen.h: $(SQL_SCHEMA_PARTS)
)
plugins/sql.o: plugins/sql-schema_gen.h
-plugins/sql: $(PLUGIN_SQL_OBJS) $(PLUGIN_LIB_OBJS) gossipd/gossip_store_wiregen.o libcommon.a
+plugins/sql: $(PLUGIN_SQL_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a
# Generated from PLUGINS definition in plugins/Makefile
ALL_C_HEADERS += plugins/list_of_builtin_plugins_gen.h
diff --git a/plugins/renepay/test/Makefile b/plugins/renepay/test/Makefile
index 2c86948d..f6dcb33c 100644
--- a/plugins/renepay/test/Makefile
+++ b/plugins/renepay/test/Makefile
@@ -11,7 +11,6 @@ $(PLUGIN_RENEPAY_TEST_OBJS): $(PLUGIN_RENEPAY_SRC) plugins/renepay/test/common.h
$(PLUGIN_RENEPAY_TEST_PROGRAMS): \
plugins/renepay/dijkstra.o \
plugins/renepay/chan_extra.o \
- gossipd/gossip_store_wiregen.o \
libcommon.a
check-renepay: $(PLUGIN_RENEPAY_TEST_PROGRAMS:%=unittest/%)
diff --git a/plugins/renepay/test/common.h b/plugins/renepay/test/common.h
index 4eea8adc..80146873 100644
--- a/plugins/renepay/test/common.h
+++ b/plugins/renepay/test/common.h
@@ -3,7 +3,7 @@
#include "config.h"
#include <ccan/crc32c/crc32c.h>
#include <common/gossip_store.h>
-#include <gossipd/gossip_store_wiregen.h>
+#include <common/gossip_store_wiregen.h>
#include <stdio.h>
#include <unistd.h>
#include <wire/peer_wiregen.h>
diff --git a/plugins/sql.c b/plugins/sql.c
index 7f8631b0..24c3b28c 100644
--- a/plugins/sql.c
+++ b/plugins/sql.c
@@ -5,13 +5,13 @@
#include <ccan/tal/str/str.h>
#include <common/deprecation.h>
#include <common/gossip_store.h>
+#include <common/gossip_store_wiregen.h>
#include <common/json_param.h>
#include <common/json_stream.h>
#include <common/memleak.h>
#include <common/setup.h>
#include <errno.h>
#include <fcntl.h>
-#include <gossipd/gossip_store_wiregen.h>
#include <inttypes.h>
#include <plugins/libplugin.h>
#include <sqlite3.h>
diff --git a/plugins/test/Makefile b/plugins/test/Makefile
index 167e0deb..5ec83035 100644
--- a/plugins/test/Makefile
+++ b/plugins/test/Makefile
@@ -8,7 +8,6 @@ ALL_C_SOURCES += $(PLUGIN_TEST_SRC)
ALL_TEST_PROGRAMS += $(PLUGIN_TEST_PROGRAMS)
plugins/test/run-route-overlong: \
- gossipd/gossip_store_wiregen.o \
plugins/channel_hint.o
plugins/test/run-route-calc: \
@@ -16,7 +15,6 @@ plugins/test/run-route-calc: \
common/gossmap.o \
common/node_id.o \
common/route.o \
- gossipd/gossip_store_wiregen.o \
plugins/channel_hint.o
$(PLUGIN_TEST_PROGRAMS): libcommon.a
diff --git a/plugins/test/run-route-calc.c b/plugins/test/run-route-calc.c
index de62e981..554965a4 100644
--- a/plugins/test/run-route-calc.c
+++ b/plugins/test/run-route-calc.c
@@ -7,9 +7,9 @@
#include <ccan/array_size/array_size.h>
#include <ccan/crc32c/crc32c.h>
#include <common/gossip_store.h>
+#include <common/gossip_store_wiregen.h>
#include <common/setup.h>
#include <common/utils.h>
-#include <gossipd/gossip_store_wiregen.h>
#include <stdio.h>
#include <unistd.h>
diff --git a/plugins/test/run-route-overlong.c b/plugins/test/run-route-overlong.c
index fe2575cb..ee5d02ee 100644
--- a/plugins/test/run-route-overlong.c
+++ b/plugins/test/run-route-overlong.c
@@ -3,9 +3,9 @@
#include <bitcoin/chainparams.h>
#include <ccan/crc32c/crc32c.h>
#include <common/gossip_store.h>
+#include <common/gossip_store_wiregen.h>
#include <common/setup.h>
#include <common/utils.h>
-#include <gossipd/gossip_store_wiregen.h>
#include <stdio.h>
#include <unistd.h>
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.