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

Function want_fee_update

channeld/channeld.c:1114–1147  ·  view source on GitHub ↗

Do we want to update fees? */

Source from the content-addressed store, hash-verified

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

Callers 2

send_commitFunction · 0.85
handle_peer_commit_sigFunction · 0.85

Calls 3

is_entering_stfuFunction · 0.85
channel_feerateFunction · 0.85
approx_max_feerateFunction · 0.85

Tested by

no test coverage detected