mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-02 18:35:00 +01:00
lightningd/opening_control: store funding scriptpubkey.
We'll need it in next patch to identify the funding output. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
58ee8d427a
commit
bf928ef47a
2 changed files with 11 additions and 6 deletions
|
@ -78,6 +78,9 @@ struct funding_channel {
|
||||||
/* Channel, subsequent owner of us */
|
/* Channel, subsequent owner of us */
|
||||||
struct uncommitted_channel *uc;
|
struct uncommitted_channel *uc;
|
||||||
|
|
||||||
|
/* The scriptpubkey to pay (once started) */
|
||||||
|
u8 *funding_scriptpubkey;
|
||||||
|
|
||||||
/* Whether or not this is in the middle of getting funded */
|
/* Whether or not this is in the middle of getting funded */
|
||||||
bool inflight;
|
bool inflight;
|
||||||
|
|
||||||
|
|
|
@ -267,9 +267,7 @@ static void funding_success(struct channel *channel)
|
||||||
was_pending(command_success(cmd, response));
|
was_pending(command_success(cmd, response));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void funding_started_success(struct funding_channel *fc,
|
static void funding_started_success(struct funding_channel *fc)
|
||||||
u8 *scriptPubkey,
|
|
||||||
bool supports_shutdown)
|
|
||||||
{
|
{
|
||||||
struct json_stream *response;
|
struct json_stream *response;
|
||||||
struct command *cmd = fc->cmd;
|
struct command *cmd = fc->cmd;
|
||||||
|
@ -278,10 +276,11 @@ static void funding_started_success(struct funding_channel *fc,
|
||||||
response = json_stream_success(cmd);
|
response = json_stream_success(cmd);
|
||||||
out = encode_scriptpubkey_to_addr(cmd,
|
out = encode_scriptpubkey_to_addr(cmd,
|
||||||
chainparams,
|
chainparams,
|
||||||
scriptPubkey);
|
fc->funding_scriptpubkey);
|
||||||
if (out) {
|
if (out) {
|
||||||
json_add_string(response, "funding_address", out);
|
json_add_string(response, "funding_address", out);
|
||||||
json_add_hex_talarr(response, "scriptpubkey", scriptPubkey);
|
json_add_hex_talarr(response, "scriptpubkey",
|
||||||
|
fc->funding_scriptpubkey);
|
||||||
if (fc->our_upfront_shutdown_script)
|
if (fc->our_upfront_shutdown_script)
|
||||||
json_add_hex_talarr(response, "close_to", fc->our_upfront_shutdown_script);
|
json_add_hex_talarr(response, "close_to", fc->our_upfront_shutdown_script);
|
||||||
}
|
}
|
||||||
|
@ -315,7 +314,9 @@ static void opening_funder_start_replied(struct subd *openingd, const u8 *resp,
|
||||||
fc->our_upfront_shutdown_script =
|
fc->our_upfront_shutdown_script =
|
||||||
tal_free(fc->our_upfront_shutdown_script);
|
tal_free(fc->our_upfront_shutdown_script);
|
||||||
|
|
||||||
funding_started_success(fc, funding_scriptPubkey, supports_shutdown_script);
|
/* Save this so we can indentify output for scriptpubkey */
|
||||||
|
fc->funding_scriptpubkey = tal_steal(fc, funding_scriptPubkey);
|
||||||
|
funding_started_success(fc);
|
||||||
|
|
||||||
/* Mark that we're in-flight */
|
/* Mark that we're in-flight */
|
||||||
fc->inflight = true;
|
fc->inflight = true;
|
||||||
|
@ -1063,6 +1064,7 @@ static struct command_result *json_fundchannel_start(struct command *cmd,
|
||||||
fc->cancels = tal_arr(fc, struct command *, 0);
|
fc->cancels = tal_arr(fc, struct command *, 0);
|
||||||
fc->uc = NULL;
|
fc->uc = NULL;
|
||||||
fc->inflight = false;
|
fc->inflight = false;
|
||||||
|
fc->funding_scriptpubkey = NULL;
|
||||||
|
|
||||||
if (!param(fc->cmd, buffer, params,
|
if (!param(fc->cmd, buffer, params,
|
||||||
p_req("id", param_node_id, &id),
|
p_req("id", param_node_id, &id),
|
||||||
|
|
Loading…
Add table
Reference in a new issue