dual-funding: don't override default if multifundchannel doesn't set feerate.

mfc->feerate_str is *never* NULL, since we set it in getfeerate; this is
confusing, as many places check for NULL.

Indeed, the logic in perform_fundpsbt() was *wrong* in this case: it used
`normal` (if it was NULL, which it never was) instead of `opening` to fundpsbt.

And the correct thing is for multifundchannel to not use a string here at
all, but to use the exact feerate it is counting on (even the same
string may have different values now if a block has come in).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-06-26 08:39:21 +09:30
parent 5332a8a67a
commit dd76d60b0d

View file

@ -1485,8 +1485,7 @@ perform_fundpsbt(struct multifundchannel_command *mfc, u32 feerate)
type_to_string(tmpctx, struct amount_sat,
&sum));
}
json_add_string(req->js, "feerate",
mfc->feerate_str ? mfc->feerate_str : "normal");
json_add_string(req->js, "feerate", tal_fmt(tmpctx, "%uperkw", feerate));
{
size_t startweight;
@ -1558,9 +1557,8 @@ getfeerate(struct multifundchannel_command *mfc)
mfc);
/* Internally, it defaults to 'opening', so we use that here */
if (!mfc->feerate_str)
mfc->feerate_str = "opening";
json_add_string(req->js, "feerate", mfc->feerate_str);
json_add_string(req->js, "feerate",
mfc->feerate_str ? mfc->feerate_str: "opening");
return send_outreq(mfc->cmd->plugin, req);
}