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

Function want_blockheight_update

channeld/channeld.c:1150–1181  ·  view source on GitHub ↗

Do we want to update blockheight? */

Source from the content-addressed store, hash-verified

1148
1149/* Do we want to update blockheight? */
1150static bool want_blockheight_update(const struct peer *peer, u32 *height)
1151{
1152 u32 last;
1153
1154 if (peer->channel->opener != LOCAL)
1155 return false;
1156
1157 if (peer->channel->lease_expiry == 0)
1158 return false;
1159
1160 /* No block update while quiescing! */
1161 if (is_entering_stfu(peer))
1162 return false;
1163
1164 /* What's the current blockheight */
1165 last = get_blockheight(peer->channel->blockheight_states,
1166 peer->channel->opener, LOCAL);
1167
1168 if (peer->our_blockheight < last) {
1169 status_broken("current blockheight %u less than last %u",
1170 peer->our_blockheight, last);
1171 return false;
1172 }
1173
1174 if (peer->our_blockheight == last)
1175 return false;
1176
1177 if (height)
1178 *height = peer->our_blockheight;
1179
1180 return true;
1181}
1182
1183/* Returns commitment_signed msg, sets @local_anchor */
1184static u8 *send_commit_part(const tal_t *ctx,

Callers 1

send_commitFunction · 0.85

Calls 2

is_entering_stfuFunction · 0.85
get_blockheightFunction · 0.85

Tested by

no test coverage detected