Do we want to update blockheight? */
| 1148 | |
| 1149 | /* Do we want to update blockheight? */ |
| 1150 | static 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 */ |
| 1184 | static u8 *send_commit_part(const tal_t *ctx, |
no test coverage detected