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

Function update_commitment_tx_added

tests/plugins/channeld_fakenet.c:174–219  ·  view source on GitHub ↗

Tell lightningd that htlc is fully committed. */

Source from the content-addressed store, hash-verified

172
173/* Tell lightningd that htlc is fully committed. */
174static void update_commitment_tx_added(struct info *info, u64 htlc_id)
175{
176 struct changed_htlc *changed;
177 u8 *msg;
178 const struct htlc **htlcs = tal_arr(tmpctx, const struct htlc *, 0);
179
180 changed = tal_arr(tmpctx, struct changed_htlc, 1);
181 changed->id = htlc_id;
182 changed->newstate = SENT_ADD_COMMIT;
183 /* Tell it we committed */
184 msg = towire_channeld_sending_commitsig(NULL,
185 info->commit_num,
186 NULL,
187 info->fee_states,
188 info->blockheight_states,
189 changed);
190 daemon_conn_send(info->dc, take(msg));
191
192 channel_sending_commit(info->channel, &htlcs);
193
194 /* Tell it we got revoke & ack from them. */
195 pretend_got_revoke(info, htlc_id, RCVD_ADD_REVOCATION);
196
197 changed->newstate = RCVD_ADD_ACK_COMMIT;
198 msg = towire_channeld_got_commitsig(NULL,
199 info->commit_num,
200 info->fee_states,
201 info->blockheight_states,
202 &info->fakesig,
203 NULL,
204 NULL,
205 NULL,
206 NULL,
207 changed,
208 info->commit_tx,
209 NULL);
210 daemon_conn_send(info->dc, take(msg));
211
212 /* Tell full_channel.c the htlc is totally committed. */
213 channel_rcvd_revoke_and_ack(info->channel, &htlcs);
214 channel_rcvd_commit(info->channel, &htlcs);
215 channel_sending_revoke_and_ack(info->channel);
216
217 /* Final change to SENT_ADD_ACK_REVOCATION is implied */
218 info->commit_num++;
219}
220
221static bool ecdh_maybe_blinding(const struct pubkey *ephemeral_key,
222 const struct pubkey *blinding,

Callers 1

handle_offer_htlcFunction · 0.85

Calls 6

daemon_conn_sendFunction · 0.85
channel_sending_commitFunction · 0.85
pretend_got_revokeFunction · 0.85
channel_rcvd_commitFunction · 0.85

Tested by

no test coverage detected