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

Function invert_htlcs

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

HTLCs as seen from other side. */

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected