| 52 | }; |
| 53 | |
| 54 | static 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 | max_feerate = feerate_max(ld, NULL); |
| 66 | |
| 67 | /* The channel opener should use a slightly higher than minimal feerate |
| 68 | * in order to avoid excessive feerate disagreements */ |
| 69 | if (channel->opener == LOCAL) { |
| 70 | feerate += ld->config.feerate_offset; |
| 71 | if (feerate > max_feerate) |
| 72 | feerate = max_feerate; |
| 73 | } |
| 74 | |
| 75 | return feerate; |
| 76 | } |
| 77 | |
| 78 | void channel_update_feerates(struct lightningd *ld, const struct channel *channel) |
| 79 | { |
no test coverage detected