mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 14:24:09 +01:00
plugin: make sure multifundchannel / fundchannel unreserve correctly on failure.
We were marking our inputs very late, which means any early failure would not know to unreserve them. This becomes particularly bad when we start enforcing emergency reserves. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
7894d7136f
commit
d882a38619
1 changed files with 4 additions and 5 deletions
|
@ -1203,11 +1203,6 @@ mfc_psbt_acquired(struct multifundchannel_command *mfc)
|
|||
* for the life of the tx */
|
||||
psbt_add_serials(mfc->psbt, TX_INITIATOR);
|
||||
|
||||
/* We also mark all of our inputs as *ours*, so we
|
||||
* can easily identify them for `signpsbt`, later */
|
||||
for (size_t i = 0; i < mfc->psbt->num_inputs; i++)
|
||||
psbt_input_mark_ours(mfc->psbt, &mfc->psbt->inputs[i]);
|
||||
|
||||
return perform_channel_start(mfc);
|
||||
}
|
||||
|
||||
|
@ -1372,6 +1367,10 @@ after_fundpsbt(struct command *cmd,
|
|||
if (!psbt_set_version(mfc->psbt, 2))
|
||||
goto fail;
|
||||
|
||||
/* Mark our inputs now, so we unreserve correctly on failure! */
|
||||
for (size_t i = 0; i < mfc->psbt->num_inputs; i++)
|
||||
psbt_input_mark_ours(mfc->psbt, &mfc->psbt->inputs[i]);
|
||||
|
||||
field = json_get_member(buf, result, "feerate_per_kw");
|
||||
if (!field || !json_to_u32(buf, field, &mfc->feerate_per_kw))
|
||||
goto fail;
|
||||
|
|
Loading…
Add table
Reference in a new issue