mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-19 05:44:12 +01:00
dualopend: use a lower feerate for first commitment tx for anchors.
We need to know both, because in theory we could negotiate a non-anchor channel even if they support it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
96e198f751
commit
6087decec3
@ -27,7 +27,8 @@ every input. An error (code 309) will be returned if this requirement
|
||||
is not met.
|
||||
|
||||
*commitment\_feerate* is an optional field. Sets the feerate for
|
||||
commitment transactions: see **fundchannel**.
|
||||
commitment transactions for non-anchor channels: see **fundchannel**.
|
||||
For anchor channels, it is ignored.
|
||||
|
||||
*funding\_feerate* is an optional field. Sets the feerate for the
|
||||
funding transaction. Defaults to 'opening' feerate.
|
||||
|
@ -2936,6 +2936,7 @@ static struct command_result *json_openchannel_init(struct command *cmd,
|
||||
oa->our_upfront_shutdown_script,
|
||||
our_upfront_shutdown_script_wallet_index,
|
||||
*feerate_per_kw,
|
||||
unilateral_feerate(cmd->ld->topology, true),
|
||||
*feerate_per_kw_funding,
|
||||
channel->channel_flags,
|
||||
amount_sat_zero(*request_amt) ?
|
||||
@ -3478,6 +3479,7 @@ static struct command_result *json_queryrates(struct command *cmd,
|
||||
oa->our_upfront_shutdown_script,
|
||||
our_upfront_shutdown_script_wallet_index,
|
||||
*feerate_per_kw,
|
||||
unilateral_feerate(cmd->ld->topology, true),
|
||||
*feerate_per_kw_funding,
|
||||
channel->channel_flags,
|
||||
amount_sat_zero(*request_amt) ?
|
||||
|
@ -2929,13 +2929,15 @@ static void opener_start(struct state *state, u8 *msg)
|
||||
struct tx_state *tx_state = state->tx_state;
|
||||
struct amount_sat *requested_lease;
|
||||
size_t locktime;
|
||||
u32 nonanchor_feerate, anchor_feerate;
|
||||
|
||||
if (!fromwire_dualopend_opener_init(state, msg,
|
||||
&tx_state->psbt,
|
||||
&tx_state->opener_funding,
|
||||
&state->upfront_shutdown_script[LOCAL],
|
||||
&state->local_upfront_shutdown_wallet_index,
|
||||
&state->feerate_per_kw_commitment,
|
||||
&nonanchor_feerate,
|
||||
&anchor_feerate,
|
||||
&tx_state->feerate_per_kw_funding,
|
||||
&state->channel_flags,
|
||||
&requested_lease,
|
||||
@ -2962,6 +2964,12 @@ static void opener_start(struct state *state, u8 *msg)
|
||||
state->their_features);
|
||||
open_tlv->channel_type = state->channel_type->features;
|
||||
|
||||
/* Given channel type, which feerate do we use? */
|
||||
if (channel_type_has_anchors(state->channel_type))
|
||||
state->feerate_per_kw_commitment = anchor_feerate;
|
||||
else
|
||||
state->feerate_per_kw_commitment = nonanchor_feerate;
|
||||
|
||||
if (requested_lease)
|
||||
state->requested_lease = tal_steal(state, requested_lease);
|
||||
|
||||
|
@ -188,6 +188,7 @@ msgdata,dualopend_opener_init,local_shutdown_len,u16,
|
||||
msgdata,dualopend_opener_init,local_shutdown_scriptpubkey,u8,local_shutdown_len
|
||||
msgdata,dualopend_opener_init,local_shutdown_wallet_index,?u32,
|
||||
msgdata,dualopend_opener_init,feerate_per_kw,u32,
|
||||
msgdata,dualopend_opener_init,anchor_feerate_per_kw,u32,
|
||||
msgdata,dualopend_opener_init,feerate_per_kw_funding,u32,
|
||||
msgdata,dualopend_opener_init,channel_flags,u8,
|
||||
msgdata,dualopend_opener_init,requested_sats,?amount_sat,
|
||||
|
Can't render this file because it has a wrong number of fields in line 16.
|
Loading…
Reference in New Issue
Block a user