MCPcopy Create free account
hub / github.com/ElementsProject/lightning / default_feerate

Function default_feerate

lightningd/channel_control.c:54–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52};
53
54static u32 default_feerate(struct lightningd *ld, const struct channel *channel,
55 bool add_offset)
56{
57 u32 max_feerate;
58 bool anchors = channel_type_has_anchors(channel->type);
59 u32 feerate = unilateral_feerate(ld->topology, anchors);
60
61 /* Nothing to do if we don't know feerate. */
62 if (!feerate)
63 return 0;
64
65 /* We only clamp the feerate we propose here, and the opener pays it. */
66 max_feerate = our_feerate_max(ld, NULL);
67
68 /* The channel opener should use a slightly higher than minimal feerate
69 * in order to avoid excessive feerate disagreements */
70 if (channel->opener == LOCAL) {
71 feerate += ld->config.feerate_offset;
72 if (feerate > max_feerate)
73 feerate = max_feerate;
74 }
75
76 return feerate;
77}
78
79void channel_update_feerates(struct lightningd *ld, const struct channel *channel)
80{

Callers 1

channel_update_feeratesFunction · 0.85

Calls 3

channel_type_has_anchorsFunction · 0.85
our_feerate_maxFunction · 0.85
unilateral_feerateFunction · 0.70

Tested by

no test coverage detected