splice script: Zero out wallet fund requests
What changed, and why it matters
This commit is a preparatory code change for a future feature. It adds a new field called needed_funds and moves wallet withdrawal amounts into that field, zeroing out the original values so they can be recalculated later. There is no indication in the commit itself that this fixes a security bug or vulnerability.
No security action is indicated by this commit alone. Treat as normal feature/refactoring work. If evaluating a broader splice security issue, look for follow-up commits that actually implement the dynamic wallet funding logic and verify amounts are recalculated safely.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies the Core Lightning splice plugin (plugins/spender/splice.c and splice.h). It introduces a struct amount_sat needed_funds field on struct splice_cmd, initializes it to zero, and adds a loop in execute_splice() that, for each splice action that draws from the on-chain wallet, copies action->out_sat into needed_funds and then sets action->out_sat to zero. The commit message frames this as groundwork for dynamic wallet funding, not as a security fix.
Changed components
plugins/spender/splice.cplugins/spender/splice.hInspect captured patch +19 / −0
diff --git a/plugins/spender/splice.c b/plugins/spender/splice.c
index 9fbfff59..66cec21b 100644
--- a/plugins/spender/splice.c
+++ b/plugins/spender/splice.c
@@ -1200,6 +1200,21 @@ static struct command_result *execute_splice(struct command *cmd,
}
}
+ /* Set needed funds to the wallet contributions. */
+ for (size_t i = 0; i < tal_count(splice_cmd->actions); i++) {
+ action = splice_cmd->actions[i];
+ state = splice_cmd->states[i];
+ if (action->onchain_wallet
+ && !amount_sat_is_zero(action->out_sat)) {
+ splice_cmd->needed_funds = action->out_sat;
+ plugin_log(cmd->plugin, LOG_INFORM, "setting"
+ " needed_funds to %s",
+ fmt_amount_sat(tmpctx,
+ splice_cmd->needed_funds));
+ action->out_sat = AMOUNT_SAT(0);
+ }
+ }
+
return continue_splice(cmd, splice_cmd);
}
@@ -1497,6 +1512,7 @@ json_splice(struct command *cmd, const char *buf, const jsmntok_t *params)
splice_cmd->emergency_sat = AMOUNT_SAT(0);
splice_cmd->debug_log = *debug_log ? tal_strdup(splice_cmd, "") : NULL;
splice_cmd->debug_counter = 0;
+ splice_cmd->needed_funds = AMOUNT_SAT(0);
memset(&splice_cmd->final_txid, 0, sizeof(splice_cmd->final_txid));
/* If script validates as json, parse it as json instead */
diff --git a/plugins/spender/splice.h b/plugins/spender/splice.h
index 97875d2a..f52777fe 100644
--- a/plugins/spender/splice.h
+++ b/plugins/spender/splice.h
@@ -2,6 +2,7 @@
#define LIGHTNING_PLUGINS_SPENDER_SPLICE_H
#include "config.h"
+#include <common/amount.h>
#include <plugins/libplugin.h>
extern const struct plugin_command splice_commands[];
@@ -55,6 +56,8 @@ struct splice_cmd {
char *debug_log;
/* Counter used for more readable debug logs */
int debug_counter;
+ /* Remaining funds needed from wallet */
+ struct amount_sat needed_funds;
};
#endif /* LIGHTNING_PLUGINS_SPENDER_SPLICE_H */
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.