mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-26 10:24:29 +01:00
mfc-df: after psbt signed, send to openchannel_signed if v2s
If there's an v2 destinations, they'll broadcast the tx for us
This commit is contained in:
@@ -1566,6 +1566,13 @@ after_signpsbt(struct command *cmd,
|
||||
json_tok_full_len(field),
|
||||
json_tok_full(buf, field));
|
||||
|
||||
if (!psbt_finalize(psbt))
|
||||
plugin_err(mfc->cmd->plugin,
|
||||
"mfc %"PRIu64": Signed PSBT won't finalize"
|
||||
"%s", mfc->id,
|
||||
type_to_string(tmpctx, struct wally_psbt, psbt));
|
||||
|
||||
|
||||
/* Replace the PSBT. */
|
||||
tal_free(mfc->psbt);
|
||||
mfc->psbt = tal_steal(mfc, psbt);
|
||||
@@ -1599,10 +1606,23 @@ after_signpsbt(struct command *cmd,
|
||||
*/
|
||||
for (size_t i = 0; i < tal_count(mfc->destinations); ++i) {
|
||||
struct multifundchannel_destination *dest;
|
||||
enum multifundchannel_state expected_state;
|
||||
|
||||
dest = &mfc->destinations[i];
|
||||
|
||||
/* Check that every dest is in the right state */
|
||||
expected_state = dest->protocol == OPEN_CHANNEL ?
|
||||
MULTIFUNDCHANNEL_SIGNED : MULTIFUNDCHANNEL_COMPLETED;
|
||||
assert(dest->state == expected_state);
|
||||
|
||||
dest->state = MULTIFUNDCHANNEL_DONE;
|
||||
}
|
||||
|
||||
/* If there's any v2's, we send the tx via `openchannel_signed` */
|
||||
if (dest_count(mfc, OPEN_CHANNEL) > 0) {
|
||||
return perform_openchannel_signed(mfc);
|
||||
}
|
||||
|
||||
plugin_log(mfc->cmd->plugin, LOG_DBG,
|
||||
"mfc %"PRIu64": sendpsbt.", mfc->id);
|
||||
|
||||
|
||||
@@ -484,25 +484,10 @@ perform_openchannel_signed(struct multifundchannel_command *mfc)
|
||||
"mfc %"PRIu64": parallel `openchannel_signed`.",
|
||||
mfc->id);
|
||||
|
||||
/* Check that every dest is in the right state */
|
||||
for (size_t i = 0; i < tal_count(mfc->destinations); i++) {
|
||||
struct multifundchannel_destination *dest;
|
||||
dest = &mfc->destinations[i];
|
||||
if (dest->state != MULTIFUNDCHANNEL_SIGNED) {
|
||||
// FIXME: these channels are all borked.
|
||||
redo_multifundchannel(mfc, "openchannel_signed");
|
||||
}
|
||||
}
|
||||
|
||||
if (!psbt_finalize(mfc->psbt))
|
||||
plugin_err(mfc->cmd->plugin,
|
||||
"mfc %"PRIu64": Unable to finalize parent PSBT "
|
||||
"%s",
|
||||
type_to_string(tmpctx, struct wally_psbt,
|
||||
mfc->psbt));
|
||||
|
||||
mfc->pending = tal_count(mfc->destinations);
|
||||
mfc->pending = dest_count(mfc, OPEN_CHANNEL);
|
||||
for (size_t i = 0; i < tal_count(mfc->destinations); i++) {
|
||||
if (mfc->destinations[i].protocol == FUND_CHANNEL)
|
||||
continue;
|
||||
/* We need to 'port' all of the sigs down to the
|
||||
* destination PSBTs */
|
||||
update_node_psbt(mfc, mfc->psbt,
|
||||
|
||||
Reference in New Issue
Block a user