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

Function first_node_with_unused_chan

common/splice_script.c:1440–1461  ·  view source on GitHub ↗

Searches through both tokensA and tokensB. */

Source from the content-addressed store, hash-verified

1438
1439/* Searches through both tokensA and tokensB. */
1440static struct node_id *first_node_with_unused_chan(const tal_t *ctx,
1441 struct splice_script_chan **channels,
1442 struct token **tokensA,
1443 size_t a_size,
1444 struct token **tokensB,
1445 size_t b_size)
1446{
1447 for (size_t i = 0; i < tal_count(channels); i++) {
1448 bool used = false;
1449 for (size_t j = 0; j < a_size; j++)
1450 if (matches_chan_id(tokensA[j], channels[i]->chan_id))
1451 used = true;
1452 for (size_t k = 0; k < b_size; k++)
1453 if (matches_chan_id(tokensB[k], channels[i]->chan_id))
1454 used = true;
1455 if (!used)
1456 return tal_dup(ctx, struct node_id,
1457 &channels[i]->node_id);
1458 }
1459
1460 return NULL;
1461}
1462
1463static struct channel_id *chan_for_node_index(const tal_t *ctx,
1464 struct splice_script_chan **channels,

Callers 1

resolve_channel_idsFunction · 0.85

Calls 1

matches_chan_idFunction · 0.85

Tested by

no test coverage detected