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

Function want_fee_update

channeld/channeld.c:1152–1186  ·  view source on GitHub ↗

Do we want to update fees? */

Source from the content-addressed store, hash-verified

1150
1151/* Do we want to update fees? */
1152static 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? */
1189static bool want_blockheight_update(const struct peer *peer, u32 *height)

Callers 2

send_commitFunction · 0.85
handle_peer_commit_sigFunction · 0.85

Calls 2

channel_feerateFunction · 0.85
approx_max_feerateFunction · 0.85

Tested by

no test coverage detected