MCPcopy Create free account
hub / github.com/ElementsProject/lightning / inc_height_state

Function inc_height_state

common/blockheight_states.c:77–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77bool 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
94struct height_states *dup_height_states(const tal_t *ctx,
95 const struct height_states *states TAKES)

Callers 1

blockheight_incstateFunction · 0.85

Calls 2

tal_freeFunction · 0.85
htlc_state_flagsFunction · 0.70

Tested by

no test coverage detected