From b01734087da1d44fcaf147696e187f1f2777f8c0 Mon Sep 17 00:00:00 2001 From: niftynei Date: Tue, 17 Nov 2020 19:47:48 -0600 Subject: [PATCH] df-mfc: set protocol type when we know it We'll use it for figuring out whether or not to set a utxo witness minimum, which comes much before we were setting this field. Now we set the protocol as soon as we can reasonably deduce it. --- plugins/spender/multifundchannel.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/spender/multifundchannel.c b/plugins/spender/multifundchannel.c index ea0bacf23a10..9fe215fd7072 100644 --- a/plugins/spender/multifundchannel.c +++ b/plugins/spender/multifundchannel.c @@ -545,6 +545,14 @@ connect_ok(struct command *cmd, json_tok_full_len(features_tok), json_tok_full(buf, features_tok)); + /* Set the open protocol to use now */ +#if EXPERIMENTAL_FEATURES + if (feature_negotiated(plugin_feature_set(mfc->cmd->plugin), + dest->their_features, + OPT_DUAL_FUND)) + dest->protocol = OPEN_CHANNEL; +#endif /* EXPERIMENTAL_FEATURES */ + dest->state = MULTIFUNDCHANNEL_CONNECTED; return connect_done(dest); } @@ -961,14 +969,9 @@ perform_channel_start(struct multifundchannel_command *mfc) /* Since v2 is now available, we branch depending * on the capability of the peer and our feaures */ for (i = 0; i < tal_count(mfc->destinations); ++i) { -#if EXPERIMENTAL_FEATURES - if (feature_negotiated(plugin_feature_set(mfc->cmd->plugin), - mfc->destinations[i].their_features, - OPT_DUAL_FUND)) { - mfc->destinations[i].protocol = OPEN_CHANNEL; + if (mfc->destinations[i].protocol == OPEN_CHANNEL) openchannel_init_dest(&mfc->destinations[i]); - } else -#endif /* EXPERIMENTAL_FEATURES */ + else fundchannel_start_dest(&mfc->destinations[i]); }