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

Function invert_htlcs

channeld/test/run-commit_tx.c:473–489  ·  view source on GitHub ↗

HTLCs as seen from other side. */

Source from the content-addressed store, hash-verified

471
472/* HTLCs as seen from other side. */
473static const struct htlc **invert_htlcs(const struct htlc **htlcs)
474{
475 size_t i, n = tal_count(htlcs);
476 const struct htlc **inv = tal_arr(htlcs, const struct htlc *, n);
477
478 for (i = 0; i < n; i++) {
479 struct htlc *htlc;
480 inv[i] = htlc = tal_dup(inv, struct htlc, htlcs[i]);
481 if (inv[i]->state == RCVD_ADD_ACK_REVOCATION)
482 htlc->state = SENT_ADD_ACK_REVOCATION;
483 else {
484 assert(inv[i]->state == SENT_ADD_ACK_REVOCATION);
485 htlc->state = RCVD_ADD_ACK_REVOCATION;
486 }
487 }
488 return inv;
489}
490
491int main(int argc, const char *argv[])
492{

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected