Pops the penalty base for the given commitnum from our internal list. There * may not be one, in which case we return NULL and leave the list * unmodified. */
| 2510 | * may not be one, in which case we return NULL and leave the list |
| 2511 | * unmodified. */ |
| 2512 | static struct penalty_base * |
| 2513 | penalty_base_by_commitnum(const tal_t *ctx, struct peer *peer, u64 commitnum) |
| 2514 | { |
| 2515 | struct penalty_base *res = NULL; |
| 2516 | for (size_t i = 0; i < tal_count(peer->pbases); i++) { |
| 2517 | if (peer->pbases[i]->commitment_num == commitnum) { |
| 2518 | res = tal_steal(ctx, peer->pbases[i]); |
| 2519 | tal_arr_remove(&peer->pbases, i); |
| 2520 | break; |
| 2521 | } |
| 2522 | } |
| 2523 | return res; |
| 2524 | } |
| 2525 | |
| 2526 | static u8 *got_revoke_msg(struct peer *peer, u64 revoke_num, |
| 2527 | const struct secret *per_commitment_secret, |