diff --git a/doc/lightning-openchannel_init.7.md b/doc/lightning-openchannel_init.7.md index 724b5c7b4..6bbcb21bc 100644 --- a/doc/lightning-openchannel_init.7.md +++ b/doc/lightning-openchannel_init.7.md @@ -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. diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index 02ff05e75..3dc57bc73 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -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) ? diff --git a/openingd/dualopend.c b/openingd/dualopend.c index e7dd54266..ae632331c 100644 --- a/openingd/dualopend.c +++ b/openingd/dualopend.c @@ -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); diff --git a/openingd/dualopend_wire.csv b/openingd/dualopend_wire.csv index 8c8fcb57b..8320000e4 100644 --- a/openingd/dualopend_wire.csv +++ b/openingd/dualopend_wire.csv @@ -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,