lightningd: always tell connectd the channel id.

This means lightningd needs to create the temporary one and tell it to
openingd/dualopend, rather than the other way around.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-03-23 06:57:30 +10:30
parent 57263a3eb2
commit 2bc58e2327
8 changed files with 24 additions and 12 deletions

View File

@@ -240,10 +240,6 @@ static bool setup_channel_funder(struct state *state)
* could do it for the we-are-funding case. */
set_reserve(state, state->localconf.dust_limit);
/*~ Grab a random ID until the funding tx is created (we can't do that
* until we know their funding_pubkey) */
temporary_channel_id(&state->channel_id);
#if DEVELOPER
/* --dev-force-tmp-channel-id specified */
if (dev_force_tmp_channel_id)
@@ -1308,6 +1304,7 @@ static u8 *handle_master_in(struct state *state)
&state->upfront_shutdown_script[LOCAL],
&state->local_upfront_shutdown_wallet_index,
&state->feerate_per_kw,
&state->channel_id,
&channel_flags))
master_badmsg(WIRE_OPENINGD_FUNDER_START, msg);
msg = funder_channel_start(state, channel_flags);

View File

@@ -77,6 +77,7 @@ msgdata,openingd_funder_start,len_upfront,u16,
msgdata,openingd_funder_start,upfront_shutdown_script,u8,len_upfront
msgdata,openingd_funder_start,upfront_shutdown_wallet_index,?u32,
msgdata,openingd_funder_start,feerate_per_kw,u32,
msgdata,openingd_funder_start,temporary_channel_id,channel_id,
msgdata,openingd_funder_start,channel_flags,u8,
# openingd->master: send back output script for 2-of-2 funding output
1 #include <bitcoin/chainparams.h>
77 msgtype,openingd_funder_start_reply,6102 # openingd->master: send back output script for 2-of-2 funding output
78 msgdata,openingd_funder_start_reply,script_len,u8, msgtype,openingd_funder_start_reply,6102
79 msgdata,openingd_funder_start_reply,scriptpubkey,u8,script_len msgdata,openingd_funder_start_reply,script_len,u8,
80 msgdata,openingd_funder_start_reply,scriptpubkey,u8,script_len
81 msgdata,openingd_funder_start_reply,upfront_shutdown_negotiated,bool,
82 msgdata,openingd_funder_start_reply,channel_type,channel_type,
83 # master->openingd: complete channel establishment for a funding