lightningd: don't loop through all commands every time one finishes.
What changed, and why it matters
This commit removes an old debugging assertion that was causing severe performance slowdowns when many JSON-RPC commands were active. It is a pure performance optimization with no security relevance visible in the commit or supplied references.
No security action required; treat as a routine performance improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch deletes a loop in command_exec() that iterated over every command on a json_connection and asserted cmd->pending each time any command finished. This O(n) per-command completion behavior caused quadratic slowdown under high command concurrency. The commit explicitly frames this as a performance fix, not a security fix.
Changed components
lightningd/jsonrpc.cInspect captured patch +0 / −5
diff --git a/lightningd/jsonrpc.c b/lightningd/jsonrpc.c
index 5520fdce..76baaa2d 100644
--- a/lightningd/jsonrpc.c
+++ b/lightningd/jsonrpc.c
@@ -801,11 +801,6 @@ static struct command_result *command_exec(struct json_connection *jcon,
if (res == &pending)
assert(cmd->pending);
- /* The command might outlive the connection. */
- if (jcon)
- list_for_each(&jcon->commands, cmd, list)
- assert(cmd->pending);
-
return res;
}
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.