Browse Source

mfc-df: after openchannel_signed is finished, we call finished

We done!?
fix-mocks
niftynei 4 years ago
committed by neil saitug
parent
commit
c6b45e052b
  1. 5
      plugins/spender/multifundchannel.c
  2. 3
      plugins/spender/multifundchannel.h
  3. 34
      plugins/spender/openchannel.c

5
plugins/spender/multifundchannel.c

@ -1635,9 +1635,6 @@ after_signpsbt(struct command *cmd,
return send_outreq(mfc->cmd->plugin, req);
}
static struct command_result *
multifundchannel_finished(struct multifundchannel_command *mfc);
static struct command_result *
after_sendpsbt(struct command *cmd,
const char *buf,
@ -1677,7 +1674,7 @@ after_sendpsbt(struct command *cmd,
And finally we are done.
*/
static struct command_result *
struct command_result *
multifundchannel_finished(struct multifundchannel_command *mfc)
{
unsigned int i;

3
plugins/spender/multifundchannel.h

@ -262,6 +262,9 @@ perform_fundchannel_complete(struct multifundchannel_command *mfc);
struct command_result *
perform_signpsbt(struct multifundchannel_command *mfc);
struct command_result *
multifundchannel_finished(struct multifundchannel_command *mfc);
struct command_result *
redo_multifundchannel(struct multifundchannel_command *mfc,
const char *failing_method);

34
plugins/spender/openchannel.c

@ -329,41 +329,9 @@ static bool update_node_psbt(const tal_t *ctx,
static struct command_result *
openchannel_finished(struct multifundchannel_command *mfc)
{
struct json_stream *out;
plugin_log(mfc->cmd->plugin, LOG_DBG,
"mfc %"PRIu64": done.", mfc->id);
out = jsonrpc_stream_success(mfc->cmd);
json_add_string(out, "tx", mfc->final_tx);
json_add_string(out, "txid", mfc->final_txid);
json_array_start(out, "channel_ids");
for (size_t i = 0; i < tal_count(mfc->destinations); i++) {
struct multifundchannel_destination *dest =
&mfc->destinations[i];
json_object_start(out, NULL);
json_add_node_id(out, "id", &dest->id);
json_add_channel_id(out, "channel_id", &dest->channel_id);
json_add_num(out, "outnum", dest->outnum);
json_object_end(out);
}
json_array_end(out);
json_array_start(out, "failed");
for (size_t i = 0; i < tal_count(mfc->removeds); i++) {
struct multifundchannel_removed *rm =
&mfc->removeds[i];
json_object_start(out, NULL);
json_add_node_id(out, "id", &rm->id);
json_add_string(out, "method", rm->method);
json_add_jsonstr(out, "error", rm->error);
json_object_end(out);
}
json_array_end(out);
mfc->psbt = tal_free(mfc->psbt);
return mfc_finished(mfc, out);
return multifundchannel_finished(mfc);
}
static struct command_result *

Loading…
Cancel
Save