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. */
| 1752 | * may not be one, in which case we return NULL and leave the list |
| 1753 | * unmodified. */ |
| 1754 | static struct penalty_base * |
| 1755 | penalty_base_by_commitnum(const tal_t *ctx, struct peer *peer, u64 commitnum) |
| 1756 | { |
| 1757 | struct penalty_base *res = NULL; |
| 1758 | for (size_t i = 0; i < tal_count(peer->pbases); i++) { |
| 1759 | if (peer->pbases[i]->commitment_num == commitnum) { |
| 1760 | res = tal_steal(ctx, peer->pbases[i]); |
| 1761 | tal_arr_remove(&peer->pbases, i); |
| 1762 | break; |
| 1763 | } |
| 1764 | } |
| 1765 | return res; |
| 1766 | } |
| 1767 | |
| 1768 | static u8 *got_revoke_msg(struct peer *peer, u64 revoke_num, |
| 1769 | const struct secret *per_commitment_secret, |