| 8 | #include <wire/wire.h> |
| 9 | |
| 10 | struct height_states *new_height_states(const tal_t *ctx, |
| 11 | enum side opener, |
| 12 | const u32 *blockheight) |
| 13 | { |
| 14 | struct height_states *states = tal(ctx, struct height_states); |
| 15 | |
| 16 | /* Set to NULL except terminal value */ |
| 17 | for (size_t i = 0; i < ARRAY_SIZE(states->height); i++) |
| 18 | states->height[i] = NULL; |
| 19 | |
| 20 | if (blockheight) |
| 21 | /* We reuse fee states! */ |
| 22 | states->height[last_fee_state(opener)] |
| 23 | = tal_dup(states, u32, blockheight); |
| 24 | return states; |
| 25 | } |
| 26 | |
| 27 | u32 get_blockheight(const struct height_states *height_states, |
| 28 | enum side opener, |