bookkeeper: no longer read listchannelmoves 1000 entries at a time.
What changed, and why it matters
This commit removes a performance workaround in the bookkeeper plugin that read channel movement records 1,000 entries at a time. It reverts that batching behavior so the developers can implement a proper scalability fix later. The change itself is described as a temporary step backward in performance, not a security fix or vulnerability.
No immediate security action required. Monitor follow-up commits for the promised scalability fix, since unbounded queries could reintroduce latency or memory pressure on nodes with very large numbers of channel moves.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch reverts a previous commit that batched listchannelmoves RPC calls with a limit of 1,000 entries. It removes the limited_listchannelmoves recursive helper and goes back to issuing a single unbounded listchannelmoves request after listchainmoves_done. The commit message frames this as a temporary revert to enable a proper scalability solution in follow-up patches. No security boundary is crossed, no input validation is changed, and no cryptographic or authorization logic is modified.
Changed components
plugins/bkpr/bookkeeper.cbookkeeper pluginlistchannelmoves RPC handlingInspect captured patch +8 / −26
diff --git a/plugins/bkpr/bookkeeper.c b/plugins/bkpr/bookkeeper.c
index 72cda38f..21ec62a9 100644
--- a/plugins/bkpr/bookkeeper.c
+++ b/plugins/bkpr/bookkeeper.c
@@ -55,10 +55,6 @@ static struct refresh_info *use_rinfo(struct refresh_info *rinfo)
return rinfo;
}
-/* Recursion */
-static struct command_result *limited_listchannelmoves(struct command *cmd,
- struct refresh_info *rinfo);
-
static struct command_result *rinfo_one_done(struct command *cmd,
struct refresh_info *rinfo)
{
@@ -138,36 +134,16 @@ static struct command_result *listchannelmoves_done(struct command *cmd,
"create-or-replace",
datastore_done, NULL, use_rinfo(rinfo));
- /* If there might be more, try asking for more */
- if (moves->size != 0)
- limited_listchannelmoves(cmd, rinfo);
-
return rinfo_one_done(cmd, rinfo);
}
-/* We do 1000 at a time to avoid overwhelming lightningd */
-static struct command_result *limited_listchannelmoves(struct command *cmd,
- struct refresh_info *rinfo)
-{
- struct bkpr *bkpr = bkpr_of(cmd->plugin);
- struct out_req *req;
-
- req = jsonrpc_request_start(cmd, "listchannelmoves",
- listchannelmoves_done,
- plugin_broken_cb,
- use_rinfo(rinfo));
- json_add_string(req->js, "index", "created");
- json_add_u64(req->js, "start", bkpr->channelmoves_index + 1);
- json_add_u64(req->js, "limit", 1000);
- return send_outreq(req);
-}
-
static struct command_result *listchainmoves_done(struct command *cmd,
const char *method,
const char *buf,
const jsmntok_t *result,
struct refresh_info *rinfo)
{
+ struct out_req *req;
const jsmntok_t *moves, *t;
size_t i;
struct bkpr *bkpr = bkpr_of(cmd->plugin);
@@ -183,7 +159,13 @@ static struct command_result *listchainmoves_done(struct command *cmd,
"create-or-replace",
datastore_done, NULL, use_rinfo(rinfo));
- limited_listchannelmoves(cmd, rinfo);
+ req = jsonrpc_request_start(cmd, "listchannelmoves",
+ listchannelmoves_done,
+ plugin_broken_cb,
+ use_rinfo(rinfo));
+ json_add_string(req->js, "index", "created");
+ json_add_u64(req->js, "start", bkpr->channelmoves_index + 1);
+ send_outreq(req);
return rinfo_one_done(cmd, rinfo);
}
Why this scored 11/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.