Do we want to update fees? */
| 1112 | |
| 1113 | /* Do we want to update fees? */ |
| 1114 | static bool want_fee_update(const struct peer *peer, u32 *target) |
| 1115 | { |
| 1116 | u32 current, val; |
| 1117 | |
| 1118 | if (peer->channel->opener != LOCAL) |
| 1119 | return false; |
| 1120 | |
| 1121 | /* No fee update while quiescing! */ |
| 1122 | if (is_entering_stfu(peer)) |
| 1123 | return false; |
| 1124 | |
| 1125 | current = channel_feerate(peer->channel, REMOTE); |
| 1126 | |
| 1127 | /* max is *approximate*: only take it into account if we're |
| 1128 | * trying to increase feerate. */ |
| 1129 | if (peer->desired_feerate > current) { |
| 1130 | /* FIXME: We should avoid adding HTLCs until we can meet this |
| 1131 | * feerate! */ |
| 1132 | u32 max = approx_max_feerate(peer->channel); |
| 1133 | |
| 1134 | val = peer->desired_feerate; |
| 1135 | /* Respect max, but don't let us *decrease* us */ |
| 1136 | if (val > max) |
| 1137 | val = max; |
| 1138 | if (val < current) |
| 1139 | val = current; |
| 1140 | } else |
| 1141 | val = peer->desired_feerate; |
| 1142 | |
| 1143 | if (target) |
| 1144 | *target = val; |
| 1145 | |
| 1146 | return val != current; |
| 1147 | } |
| 1148 | |
| 1149 | /* Do we want to update blockheight? */ |
| 1150 | static bool want_blockheight_update(const struct peer *peer, u32 *height) |
no test coverage detected