Skip to content

Commit fc055ca

Browse files
committed
splice: Splice script should not abort on sign
The result of splice_signed can fail for many reasons that are non-critical (already in mempool for instance). Don’t abort channels in this case as that causes a force close.
1 parent a321bcd commit fc055ca

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

plugins/spender/splice.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,26 @@ static struct command_result *splice_signed_get_result(struct command *cmd,
730730
return continue_splice(splice_cmd->cmd, splice_cmd);
731731
}
732732

733+
static struct command_result *splice_signed_error_pkg(struct command *cmd,
734+
const char *methodname,
735+
const char *buf,
736+
const jsmntok_t *error,
737+
struct splice_index_pkg *pkg)
738+
{
739+
struct splice_cmd *splice_cmd = pkg->splice_cmd;
740+
struct abort_pkg *abort_pkg;
741+
742+
splice_cmd->wetrun = false;
743+
744+
abort_pkg = tal(cmd->plugin, struct abort_pkg);
745+
abort_pkg->splice_cmd = tal_steal(abort_pkg, pkg->splice_cmd);
746+
abort_pkg->str = tal_strndup(abort_pkg, buf + error->start,
747+
error->end - error->start);
748+
abort_pkg->code = -1;
749+
750+
return make_error(cmd, abort_pkg, "splice_signed_error");
751+
}
752+
733753
static struct command_result *splice_signed(struct command *cmd,
734754
struct splice_cmd *splice_cmd,
735755
size_t index)
@@ -743,7 +763,8 @@ static struct command_result *splice_signed(struct command *cmd,
743763
pkg->index = index;
744764

745765
req = jsonrpc_request_start(cmd, "splice_signed",
746-
splice_signed_get_result, splice_error_pkg,
766+
splice_signed_get_result,
767+
splice_signed_error_pkg,
747768
pkg);
748769

749770
json_add_channel_id(req->js, "channel_id", action->channel_id);

0 commit comments

Comments
 (0)