| 1061 | } |
| 1062 | |
| 1063 | static bool blockheight_incstate(struct channel *channel, |
| 1064 | enum side sidechanged, |
| 1065 | enum htlc_state hstate) |
| 1066 | { |
| 1067 | int preflags, postflags; |
| 1068 | |
| 1069 | preflags = htlc_state_flags(hstate); |
| 1070 | postflags = htlc_state_flags(hstate + 1); |
| 1071 | |
| 1072 | /* You can't change sides. */ |
| 1073 | assert((preflags & (HTLC_LOCAL_F_OWNER|HTLC_REMOTE_F_OWNER)) |
| 1074 | == (postflags & (HTLC_LOCAL_F_OWNER|HTLC_REMOTE_F_OWNER))); |
| 1075 | |
| 1076 | /* These only advance through ADDING states. */ |
| 1077 | if (!(htlc_state_flags(hstate) & HTLC_ADDING)) |
| 1078 | return false; |
| 1079 | |
| 1080 | if (!inc_height_state(channel->blockheight_states, hstate)) |
| 1081 | return false; |
| 1082 | |
| 1083 | status_debug("Blockheight: %s->%s %s now %u", |
| 1084 | htlc_state_name(hstate), |
| 1085 | htlc_state_name(hstate+1), |
| 1086 | side_to_str(sidechanged), |
| 1087 | *channel->blockheight_states->height[hstate+1]); |
| 1088 | return true; |
| 1089 | } |
| 1090 | |
| 1091 | /* Returns flags which were changed. */ |
| 1092 | static int change_htlcs(struct channel *channel, |
no test coverage detected