| 75 | } |
| 76 | |
| 77 | bool inc_height_state(struct height_states *height_states, |
| 78 | enum htlc_state hstate) |
| 79 | { |
| 80 | /* These only advance through ADDING states. */ |
| 81 | assert(htlc_state_flags(hstate) & HTLC_ADDING); |
| 82 | |
| 83 | if (!height_states->height[hstate]) |
| 84 | return false; |
| 85 | |
| 86 | /* FIXME: We can never clash, except at final state unless someone |
| 87 | * has violated protocol (eg, send two revoke_and_ack back-to-back) */ |
| 88 | tal_free(height_states->height[hstate+1]); |
| 89 | height_states->height[hstate+1] = height_states->height[hstate]; |
| 90 | height_states->height[hstate] = NULL; |
| 91 | return true; |
| 92 | } |
| 93 | |
| 94 | struct height_states *dup_height_states(const tal_t *ctx, |
| 95 | const struct height_states *states TAKES) |
no test coverage detected