Do we want to update fees? */
| 1150 | |
| 1151 | /* Do we want to update fees? */ |
| 1152 | static bool want_fee_update(const struct peer *peer, u32 *target) |
| 1153 | { |
| 1154 | u32 current, val; |
| 1155 | |
| 1156 | if (peer->channel->opener != LOCAL) |
| 1157 | return false; |
| 1158 | |
| 1159 | #if EXPERIMENTAL_FEATURES |
| 1160 | /* No fee update while quiescing! */ |
| 1161 | if (peer->stfu) |
| 1162 | return false; |
| 1163 | #endif |
| 1164 | current = channel_feerate(peer->channel, REMOTE); |
| 1165 | |
| 1166 | /* max is *approximate*: only take it into account if we're |
| 1167 | * trying to increase feerate. */ |
| 1168 | if (peer->desired_feerate > current) { |
| 1169 | /* FIXME: We should avoid adding HTLCs until we can meet this |
| 1170 | * feerate! */ |
| 1171 | u32 max = approx_max_feerate(peer->channel); |
| 1172 | |
| 1173 | val = peer->desired_feerate; |
| 1174 | /* Respect max, but don't let us *decrease* us */ |
| 1175 | if (val > max) |
| 1176 | val = max; |
| 1177 | if (val < current) |
| 1178 | val = current; |
| 1179 | } else |
| 1180 | val = peer->desired_feerate; |
| 1181 | |
| 1182 | if (target) |
| 1183 | *target = val; |
| 1184 | |
| 1185 | return val != current; |
| 1186 | } |
| 1187 | |
| 1188 | /* Do we want to update blockheight? */ |
| 1189 | static bool want_blockheight_update(const struct peer *peer, u32 *height) |
no test coverage detected