mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-06 23:54:22 +01:00
channeld: for anchors, use minrelayfee as minimum commit tx fee to allow.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -27,23 +27,29 @@
|
||||
static void update_feerates(struct lightningd *ld, struct channel *channel)
|
||||
{
|
||||
u8 *msg;
|
||||
u32 feerate = unilateral_feerate(ld->topology,
|
||||
channel_has(channel,
|
||||
OPT_ANCHOR_OUTPUTS));
|
||||
u32 min_feerate;
|
||||
bool anchors = channel_type_has_anchors(channel->type);
|
||||
u32 feerate = unilateral_feerate(ld->topology, anchors);
|
||||
|
||||
/* Nothing to do if we don't know feerate. */
|
||||
if (!feerate)
|
||||
return;
|
||||
|
||||
/* For anchors, we just need the commitment tx to relay. */
|
||||
if (anchors)
|
||||
min_feerate = get_feerate_floor(ld->topology);
|
||||
else
|
||||
min_feerate = feerate_min(ld, NULL);
|
||||
|
||||
log_debug(ld->log,
|
||||
"update_feerates: feerate = %u, min=%u, max=%u, penalty=%u",
|
||||
feerate,
|
||||
feerate_min(ld, NULL),
|
||||
min_feerate,
|
||||
feerate_max(ld, NULL),
|
||||
penalty_feerate(ld->topology));
|
||||
|
||||
msg = towire_channeld_feerates(NULL, feerate,
|
||||
feerate_min(ld, NULL),
|
||||
min_feerate,
|
||||
feerate_max(ld, NULL),
|
||||
penalty_feerate(ld->topology));
|
||||
subd_send_msg(channel->owner, take(msg));
|
||||
@@ -618,6 +624,7 @@ bool peer_start_channeld(struct channel *channel,
|
||||
struct secret last_remote_per_commit_secret;
|
||||
secp256k1_ecdsa_signature *remote_ann_node_sig, *remote_ann_bitcoin_sig;
|
||||
struct penalty_base *pbases;
|
||||
u32 min_feerate;
|
||||
|
||||
hsmfd = hsm_get_client_fd(ld, &channel->peer->id,
|
||||
channel->dbid,
|
||||
@@ -717,6 +724,12 @@ bool peer_start_channeld(struct channel *channel,
|
||||
return false;
|
||||
}
|
||||
|
||||
/* For anchors, we just need the commitment tx to relay. */
|
||||
if (channel_type_has_anchors(channel->type))
|
||||
min_feerate = get_feerate_floor(ld->topology);
|
||||
else
|
||||
min_feerate = feerate_min(ld, NULL);
|
||||
|
||||
initmsg = towire_channeld_init(tmpctx,
|
||||
chainparams,
|
||||
ld->our_features,
|
||||
@@ -730,7 +743,7 @@ bool peer_start_channeld(struct channel *channel,
|
||||
&channel->our_config,
|
||||
&channel->channel_info.their_config,
|
||||
channel->fee_states,
|
||||
feerate_min(ld, NULL),
|
||||
min_feerate,
|
||||
feerate_max(ld, NULL),
|
||||
penalty_feerate(ld->topology),
|
||||
&channel->last_sig,
|
||||
|
||||
Reference in New Issue
Block a user