From efacada7ddffd36d52cc36e35cb7c1799069606c Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 26 Nov 2024 14:49:57 +1030 Subject: [PATCH] spender: fix multifundchannel ids. They're not always 34 (aka '"'). This is a side-effect of ids changing from u64 to strings quite a while ago. Signed-off-by: Rusty Russell --- plugins/spender/multifundchannel.c | 5 +++-- plugins/spender/multifundchannel.h | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/spender/multifundchannel.c b/plugins/spender/multifundchannel.c index ef854bee9..5fef05204 100644 --- a/plugins/spender/multifundchannel.c +++ b/plugins/spender/multifundchannel.c @@ -14,7 +14,8 @@ #include #include -extern const struct chainparams *chainparams; +/* Global counter to create unique mfc->id values */ +static u64 mfc_id; /* Which destinations has a value of "all", or -1. */ static struct multifundchannel_destination *all_dest(const struct multifundchannel_command *mfc) @@ -1999,7 +2000,7 @@ json_multifundchannel(struct command *cmd, /* Should exist; it would only nonexist if it were a notification. */ assert(cmd->id); - mfc->id = *cmd->id; + mfc->id = ++mfc_id; mfc->cmd = cmd; /* Steal destinations array, and set up mfc pointers */ diff --git a/plugins/spender/multifundchannel.h b/plugins/spender/multifundchannel.h index 966ebd4b3..891babca3 100644 --- a/plugins/spender/multifundchannel.h +++ b/plugins/spender/multifundchannel.h @@ -171,9 +171,6 @@ struct multifundchannel_command { multiple `multifundchannel` commands in parallel, or in very close sequence, which might confuse us with *which* debug message belongs with *which* command. - - We actually just reuse the id from the cmd. - Store it here for easier access. */ u64 id;