mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 20:09:18 +01:00
openingd: Pass reserve
down to openingd when funding
This commit is contained in:
parent
8d6423389a
commit
5a54f450bd
3 changed files with 24 additions and 14 deletions
|
@ -1256,15 +1256,16 @@ static struct command_result *json_fundchannel_start(struct command *cmd,
|
|||
} else
|
||||
upfront_shutdown_script_wallet_index = NULL;
|
||||
|
||||
fc->open_msg
|
||||
= towire_openingd_funder_start(fc,
|
||||
*amount,
|
||||
fc->push,
|
||||
fc->our_upfront_shutdown_script,
|
||||
upfront_shutdown_script_wallet_index,
|
||||
*feerate_per_kw,
|
||||
&tmp_channel_id,
|
||||
fc->channel_flags);
|
||||
fc->open_msg = towire_openingd_funder_start(
|
||||
fc,
|
||||
*amount,
|
||||
fc->push,
|
||||
fc->our_upfront_shutdown_script,
|
||||
upfront_shutdown_script_wallet_index,
|
||||
*feerate_per_kw,
|
||||
&tmp_channel_id,
|
||||
fc->channel_flags,
|
||||
fc->uc->reserve);
|
||||
|
||||
if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fds) != 0) {
|
||||
return command_fail(cmd, FUND_MAX_EXCEEDED,
|
||||
|
|
|
@ -99,6 +99,8 @@ struct state {
|
|||
struct channel_type *channel_type;
|
||||
|
||||
struct feature_set *our_features;
|
||||
|
||||
struct amount_sat *reserve;
|
||||
};
|
||||
|
||||
/*~ If we can't agree on parameters, we fail to open the channel.
|
||||
|
@ -245,10 +247,6 @@ static u8 *opening_negotiate_msg(const tal_t *ctx, struct state *state,
|
|||
|
||||
static bool setup_channel_funder(struct state *state)
|
||||
{
|
||||
/*~ For symmetry, we calculate our own reserve even though lightningd
|
||||
* could do it for the we-are-funding case. */
|
||||
set_reserve(state, state->localconf.dust_limit);
|
||||
|
||||
#if DEVELOPER
|
||||
/* --dev-force-tmp-channel-id specified */
|
||||
if (dev_force_tmp_channel_id)
|
||||
|
@ -329,6 +327,15 @@ static u8 *funder_channel_start(struct state *state, u8 channel_flags)
|
|||
if (!setup_channel_funder(state))
|
||||
return NULL;
|
||||
|
||||
/* If we have a reserve override we use that, otherwise we'll
|
||||
* use our default of 1% of the funding value. */
|
||||
if (state->reserve != NULL) {
|
||||
set_reserve_absolute(state, state->localconf.dust_limit,
|
||||
*state->reserve);
|
||||
} else {
|
||||
set_reserve(state, state->localconf.dust_limit);
|
||||
}
|
||||
|
||||
if (!state->upfront_shutdown_script[LOCAL])
|
||||
state->upfront_shutdown_script[LOCAL]
|
||||
= no_upfront_shutdown_script(state,
|
||||
|
@ -1352,7 +1359,8 @@ static u8 *handle_master_in(struct state *state)
|
|||
&state->local_upfront_shutdown_wallet_index,
|
||||
&state->feerate_per_kw,
|
||||
&state->channel_id,
|
||||
&channel_flags))
|
||||
&channel_flags,
|
||||
&state->reserve))
|
||||
master_badmsg(WIRE_OPENINGD_FUNDER_START, msg);
|
||||
msg = funder_channel_start(state, channel_flags);
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ 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,
|
||||
msgdata,openingd_funder_start,reserve,?amount_sat,
|
||||
|
||||
# openingd->master: send back output script for 2-of-2 funding output
|
||||
msgtype,openingd_funder_start_reply,6102
|
||||
|
|
|
Loading…
Add table
Reference in a new issue