bkpr: expose `struct bkpr` to outside bookkeeper.c.
What changed, and why it matters
This commit is a routine code cleanup in the bookkeeper plugin of Core Lightning. It moves an internal data structure definition from a source file into a new header file so other parts of the code can use it later. There is no functional change, no bug fix, and no security relevance visible in the diff.
No security action needed. Review as normal code-quality/refactoring change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change exposes struct bkpr by relocating its definition from plugins/bkpr/bookkeeper.c to a new plugins/bkpr/bookkeeper.h and adding that header to the plugin’s Makefile and to the includes in bookkeeper.c. The struct’s members (struct db *db, char *db_dsn, char *datadir) are unchanged. This is purely a refactoring step preparatory to future additions.
Changed components
plugins/bkpr/bookkeeper.cplugins/bkpr/bookkeeper.hplugins/bkpr/MakefileInspect captured patch +16 / −8
diff --git a/plugins/bkpr/Makefile b/plugins/bkpr/Makefile
index 18599631..3b8b9b73 100644
--- a/plugins/bkpr/Makefile
+++ b/plugins/bkpr/Makefile
@@ -20,6 +20,7 @@ BOOKKEEPER_SRC := $(BOOKKEEPER_PLUGIN_SRC) $(BOOKKEEPER_DB_QUERIES)
BOOKKEEPER_HEADER := \
plugins/bkpr/account.h \
plugins/bkpr/account_entry.h \
+ plugins/bkpr/bookkeeper.h \
plugins/bkpr/chain_event.h \
plugins/bkpr/channel_event.h \
plugins/bkpr/channelsapy.h \
diff --git a/plugins/bkpr/bookkeeper.c b/plugins/bkpr/bookkeeper.c
index 9a058950..df55c0c1 100644
--- a/plugins/bkpr/bookkeeper.c
+++ b/plugins/bkpr/bookkeeper.c
@@ -16,6 +16,7 @@
#include <errno.h>
#include <plugins/bkpr/account.h>
#include <plugins/bkpr/account_entry.h>
+#include <plugins/bkpr/bookkeeper.h>
#include <plugins/bkpr/chain_event.h>
#include <plugins/bkpr/channel_event.h>
#include <plugins/bkpr/channelsapy.h>
@@ -30,14 +31,6 @@
#define CHAIN_MOVE "chain_mvt"
#define CHANNEL_MOVE "channel_mvt"
-struct bkpr {
- /* The database that we store all the accounting data in */
- struct db *db;
-
- char *db_dsn;
- char *datadir;
-};
-
static struct bkpr *bkpr_of(struct plugin *plugin)
{
return plugin_get_data(plugin, struct bkpr);
diff --git a/plugins/bkpr/bookkeeper.h b/plugins/bkpr/bookkeeper.h
new file mode 100644
index 00000000..97c09e1c
--- /dev/null
+++ b/plugins/bkpr/bookkeeper.h
@@ -0,0 +1,14 @@
+#ifndef LIGHTNING_PLUGINS_BKPR_BOOKKEEPER_H
+#define LIGHTNING_PLUGINS_BKPR_BOOKKEEPER_H
+
+#include "config.h"
+
+struct bkpr {
+ /* The database that we store all the accounting data in */
+ struct db *db;
+
+ char *db_dsn;
+ char *datadir;
+};
+
+#endif /* LIGHTNING_PLUGINS_BKPR_BOOKKEEPER_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.